ThemeShaper Forums » Thematic

how to remove or filter widget areas in admin

(6 posts)
  • Started 4 years ago by em hr
  • Latest reply from em hr
  • This topic is resolved
  1. Is there anyway to rename "Primary Aside" , "Secondary Aside" , etc so the new naming scheme is reflected in the admin/widgets section. Also is it possible to remove the default widget areas altogether in favor of my own. unregister_sidebar is proving ineffective I can make sense of the the default thematic widget areas but I'm having to work too hard at explaining all of it to my clients. It would be a great help to be able to filter the names and remove those that are unused. For reference sake I am using the trunk r522.

    Posted 4 years ago #
  2. function child_remove_widget_area() {
    unregister_sidebar('primary-aside');
    }
    add_action( 'admin_init', 'child_remove_widget_area');

    This works for removing a widget area but it would be nice to just be able to rename them in a way that relates to the project at hand and doesn't require providing a client with complicated widget maps/legends. Any thoughts?

    Posted 4 years ago #
  3. Now I'm trying to use the new widget_area function from the trunk r522 to add a new add a new sidebar in place of the one I have removed. Unfortunately in a child theme the following code wont work.

    function child_widgets_init() {
    	if ( !function_exists('register_sidebars') )
      			return;
      		thematic_create_widget_area('My Widget Area Name', thematic_before_widget(), thematic_after_widget(), thematic_before_title(), thematic_after_title(),'widget_area_primary_aside');
      	}
       	add_action('init', 'child_widgets_init' );

    The widget is registered and appears in the admin but when given a widget the sidebar/widget_area doesn't hook into widget_area_primary_aside. Hmmmm. I think I need to look closer into the widgets-extentions.php

    Posted 4 years ago #
  4. Hi,

    if you want to add a second widget area to an action hook you need to define / create your own thematic_standard_widget_area() similar to this one:

    // this is our standard function for a widget area
    function thematic_standard_widget_area() {
    	$hook = current_filter();
    	$hook = thematic_process_hook($hook);
    	if (is_sidebar_active($hook)) {
    		echo thematic_before_widget_area($hook);
    		dynamic_sidebar($hook);
    		echo thematic_after_widget_area($hook);
    	}
    }

    Chris

    Posted 4 years ago #
  5. Hi,

    I'm still working on that widget area thing. It's working in the latest SVN copy, but I don't really like it.

    Will test an array version (incuding a filter) in the next days.

    Chris

    Posted 4 years ago #
  6. Yeah I've been messing with arrays and loops to automate Nathan Rices work but have had some unpredictable results. Removing and adding widgets works flawlessly with an array and a foreach loop but hooking them in keeps breaking things with widget areas showing multiple times and sometimes before the head. Ah well I'm learning what doesn't work at least.

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.