ThemeShaper Forums » Thematic

[closed]

Change the order widget areas are stacked

(8 posts)
  • Started 3 years ago by mirko77
  • Latest reply from malinki
  • This topic is not resolved

Tags:

  1. I created some custom widgets and I added them to the admin area.

    How can I customise the stack order? I create a "Header Left" and "Header Right" areas and I would like to have them at the top of my list (in the widget admin page).

    Thank you

    Posted 3 years ago #
  2. Hi,

    if you used the filter 'thematic_widgetized_areas' to create the widget areas, change the 'admin_menu_order' to something below 100 for your widget areas. Both will show up above Primary Aside.

    Chris

    Posted 3 years ago #
  3. Thank you!

    Posted 3 years ago #
  4. What if I didn't use the filter 'thematic_widgetized_areas'? (I wouldn't even know if I had actually, but I can't see anything akin to 'admin_menu_order' in what I did)!

    I added a 'tertiary aside' using:

    function my_widgets_init() {
    register_sidebar(array(
    'name' => 'Tertiary Aside',
    'id' => 'tertiary-aside',
    'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    'after_widget' => "",
    'before_title' => "<h3 class=\"widgettitle\">",
    'after_title' => "</h3>\n",
    ));

    }
    add_action( 'init', 'my_widgets_init' );

    function my_extra_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('tertiary-aside') ) {
    echo '<div id="tertiary-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
    dynamic_sidebar('tertiary-aside');
    echo '' . "\n" . '</div><!-- #tertiary-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_belowmainasides', 'my_extra_widgets', 8);

    and it would be great if it could show up under the 'Second Aside' in the list.

    I have looked at the somthing new 'bout post, but can't figure it out!

    Thx.

    Posted 3 years ago #
  5. i don't think it can be done in your code. i highly recommend filtering the thematic_widget_areas array.. which i believe is the method shown the post you referenced.

    'admin_menu_order' is then the array key you need to target to control where it gets sorted in the admin/backend

    Posted 3 years ago #
  6. Gorblimey guv'nor... it works!

    Add a third aside and have it show third in list of widgetized areas:

    function add_tertiary_aside($content) {
    $content['Tertiary Aside'] = array(
    'admin_menu_order' => 300,
    'args' => array (
    'name' => 'Tertiary Aside',
    'id' => 'tertiary-aside',
    'before_widget' => thematic_before_widget(),
    'after_widget' => thematic_after_widget(),
    'before_title' => thematic_before_title(),
    'after_title' => thematic_after_title(),
    ),
    'action_hook' => 'thematic_belowmainasides',
    'function' => 'thematic_tertiary_aside',
    'priority' => 8,
    );
    return $content;
    }
    add_filter('thematic_widgetized_areas', 'add_tertiary_aside');

    function thematic_tertiary_aside() {
    if (is_sidebar_active('tertiary-aside')) {
    echo thematic_before_widget_area('tertiary-aside');
    dynamic_sidebar('tertiary-aside');
    echo thematic_after_widget_area('tertiary-aside');
    }
    }

    Thx Madame Viking!

    But is it possible to assign the main-aside class to the new widget area?

    Posted 3 years ago #
  7. yuppers. got this from gene. i was looking to change the class on a widget with id of header-aside so you'll need to change that to your id

    //change class of header aside
    function child_header_widget_class($content) {
    	$child_class = str_replace('header-aside" class="aside', 'header-aside" class="aside main-aside', $content);
    return $child_class;
    }
    add_filter('thematic_before_widget_area', 'child_header_widget_class');
    Posted 3 years ago #
  8. Ahh! Muchos gracias. My deadline looks achievable and a great weight has lifted from my shoulders. :-)

    For third aside people, remember to #third_aside_div_name {clear: right;} to get them to stack nicely.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.