Removing unwanted widget regions
Often, when we use WordPress themes downloaded from the Internet, we have widget regions, which can interfere with ordinary users. Today we will deal with their removal..
WordPress Registered Widget Area Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
//Code of the Framework to register 2 Sidebars function xtreme_register_dynamic_sidebars() { register_sidebar( array( 'name' => 'Sidebar One', 'id' => 'sidebar-one', 'description' => 'Sidebar One', 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>' )); register_sidebar( array( 'name' => 'Sidebar Two', 'id' => 'sidebar-two', 'description' => 'Sidebar Two', 'before_widget' => ' <li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>' )); do_action('childtheme_sidebars'); } add_action( 'widgets_init', 'xtreme_register_dynamic_sidebars' ); |
For deleting this widget needed in a file function.php your theme add code:
1 2 3 4 5 |
//functions.php im Child-Theme function xtreme_unregister_sidebar() { unregister_sidebar('sidebar-two'); } add_action( 'childtheme_sidebars', 'xtreme_unregister_sidebar' ); |
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.