How to create a widget area in wordpress pages section. if I add below code in my functions.php file the widget created in dashboard menu section I want to add additional widget in my pages section not in dashboard.
Add a widget to the dashboard.
//This function is hooked into the 'wp_dashboard_setup' action below.
function example_add_dashboard_widgets() {
wp_add_dashboard_widget(
'example_dashboard_widget', // Widget slug.
'Example Dashboard Widget', // Title.
'example_dashboard_widget_function' // Display function.
);
}
add_action( 'wp_dashboard_setup', 'example_add_dashboard_widgets' );
Create the function to output the contents of our Dashboard Widget.
function example_dashboard_widget_function() {
// Display whatever it is you want to show.
echo "Hello World, I'm a great Dashboard Widget";
}
you should register sidebar in functions.php as
it will register sidebar(widget) in your dashboard. Now you can you is it anywhere by
This function already exists in default theme
you can create multiple widget area by copy and pasting this and chage the id every time
In function.php add:
Then add next code in place u wanna use this area, for example in your header.php: