I’m working on a custom plugin along the lines suggested by your docs to add a plugin to the header. However, I need it to add a different widget depending on whether the Front page is loaded. Is there a way to detect whether the visitor is on the home page from within the plugin?
And second, once I added this plugin, the widget area is always loaded on the site. Even when I deactivate the plugin and delete it from the server and clear all the caches, it is still loading the widget. Any idea why that would be the case?
function be_header() {
add_action(‘ava_after_main_menu’, ‘enfold_customization_header_widget_area’ );
}
function enfold_customization_header_widget_area() {
global $post;
if($post->ID == 1946) { //was hoping this would be dynamic
dynamic_sidebar( ‘booking-home’ ); // never loads
} else {
dynamic_sidebar( ‘booking’ ); //always loads even when the plugin is deleted
}
}
?>
Any help you can provide is greatly appreciated.
Hi davidkfry!
You can use is_home() condition – https://codex.wordpress.org/Function_Reference/is_home
Regards,
Yigit