Pawan Kumawat

Fetch WordPress Categories

Fetch wordpress categories Using inbuilt functions like get_categories(), wp_list_categories(), wp_dropdown_categories().

Adding Sidebar in WordPress Themes

How to Add a Custom Sidebar to a WordPress Theme? What’s a sidebar in WordPress ? WordPress Sidebars allow you display all type of widgets inside your theme. And you can use “sidebars” to display widgets anywhere you want.All themes by default come with at least one sidebar in it. Sidebar is one of the most used Requirements For many developers. For adding sidebar we will use one hook and one WordPress function. widgets_init hook register_sidebar function About “register_sidebar” register_sidebar( array|string $args = array() )   It will returns the sidebar ID. Parameters ‘name’ (string) The name or title of the sidebar displayed in the Widgets interface. Default ‘Sidebar $instance’. ‘id’ (string) The unique identifier by which the sidebar will be called. Default ‘sidebar-$instance’. ‘description’ (string) Description of the sidebar, displayed in the Widgets interface. Default empty string. ‘class’ (string) Extra CSS class to assign to the sidebar in the

Customize Woocommerce Settings Tab

Let’s talk about customizing Woocommerce Admin setting Tabs.To hide a specific Woocommerce setting tab or want to customize the Woocommerce setting tabs, not the entire sub-menu, but just a tab.For just Removing tabs we can use

Convert PHP Array into JavaScript Array.

To convert both a normal PHP array, a multidimensional PHP array, and a nested PHP array into JavaScript arrays, you can use JSON encoding and decoding as previously explained. JSON is well-suited for handling various data structures, including both simple arrays and complex nested arrays.

Add Custom Dashboard Widgets in WordPress.

To add custom dashboard widgets in WordPress, you can use the `wp_add_dashboard_widget` function. This function allows you to create and display custom widgets on the WordPress dashboard. The `wp_add_dashboard_widget` function is used to register and display a custom dashboard widget. It requires three parameters: 1. `$widget_id` (string) – The ID of the widget. This ID must be unique to avoid conflicts with other dashboard widgets. It’s used as a reference for the widget, so make sure to choose a unique and descriptive ID. 2. `$widget_name` (string) – The name or title of the widget. This is the text that will be displayed as the title of the dashboard widget. 3. `$callback` (callable) – The callback function that renders the content of the widget. This function will be responsible for generating the HTML and content to be displayed in the custom dashboard widget. It should accept no arguments as WordPress will

Categories