ThemeShaper Forums » Thematic

[closed]

Remove/ unregister widget from admin panel and theme

(4 posts)
  • Started 3 years ago by mirko77
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. I have been trying to remove some default widgets both from the admin panel and my default child theme with no luck.

    For example, I added a search bar next to my main navigation through code and I would like to remove completely the "Search" widget.

    I tried to remove these lines from widgets-extensions.php:

    // Finished intializing Widgets plugin, now let's load the thematic default widgets
    
    	register_widget('THM_Widget_Search');
    	register_widget('THM_Widget_Meta');
    	register_widget('THM_Widget_RSSlinks');
    
    	// Pre-set Widgets
    	$preset_widgets = array (
    		'primary-aside'  => array( 'search-2', 'pages-2', 'categories-2', 'archives-2' ),
    		'secondary-aside'  => array( 'links-2', 'rss-links-2', 'meta-2' )
    		);

    but nothing changed.

    Any suggestion would be very much appreciated

    Posted 3 years ago #
  2. I have had the same problem. Used the code below in my functinos file:

    ///* Defining Widget Areas */
    function remove_widget_areas($content) {
    unset($content['Index Top']);
    unset($content['Index Bottom']);
    unset($content['Index Insert']);
    unset($content['Single Top']);
    unset($content['Single Bottom']);
    unset($content['Single Insert']);
    unset($content['Page Top']);
    unset($content['Page Bottom']);
    return $content; }

    add_filter('thematic_widgetized_areas', 'remove_widget_areas');

    It had absolutely no effect on the number of widgets showing in the admin area.

    Any help from the moderator would be apreciated.

    Posted 3 years ago #
  3. /* Defining Widget Areas */

    function remove_widget_areas($content) {
    unset($content['Primary Aside']);
    unset($content['Secondary Aside']);
    unset($content['1st Subsidiary Aside']);
    unset($content['2nd Subsidiary Aside']);
    unset($content['3rd Subsidiary Aside']);
    unset($content['Text Top']);
    unset($content['Index Insert']);
    unset($content['Index Bottom']);
    unset($content['Single Top']);
    unset($content['Single Insert']);
    unset($content['Single Bottom']);
    unset($content['Page Top']);
    unset($content['Page Bottom']);
    return $content;
    }
    add_filter('thematic_widgetized_areas', 'remove_widget_areas');

    This should remove all pesky default widgets within Thematic.

    Posted 3 years ago #
  4. @dave your solution is perfect for unregistering widget areas. i believe the OP from 4 months ago wanted to remove the actual widgets. in which case the first result in google reveals:

    function unregister_problem_widgets() {
    unregister_sidebar_widget('Calendar');
    unregister_sidebar_widget('Search');
    }
    add_action('widgets_init','unregister_problem_widgets');

    from:
    http://bookmarks.honewatson.com/2008/04/22/unregister-widgets-in-wordpress-functionsphp-file/

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.