• Resolved zeaks

    (@zeaks)


    I’m trying to add another sidebar widget area under the main one in Twenty Eleven. I’m not sure if I’ve done it right, but it seems to work. The only issue so far is in appearance > widgets it shows up at the top of the list, when I want it to display as the second one on the list.

    This is how I did it in case that info is needed. I made a copy of sidebar.php and renamed it to sidebar-extra.php then changed
    <?php if ( ! dynamic_sidebar( 'sidebar-6' ) ) : ?> in it, which is the name of my widget area.

    I added the sidebar call to index.php
    <?php get_sidebar( 'extra' ); ?>

    And in my functions I added

    register_sidebar( array(
    		'name' => __( 'Sidebar area two', 'child-theme' ),
    		'id' => 'sidebar-6',
    		'description' => __( 'An optional widget area for your sidebar', 'child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    Is there something I can add to this to put it in the proper position in widget options?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    Create a child theme for your customisations. Once your child theme is active, we should be able to help with the customisation.

    Thread Starter zeaks

    (@zeaks)

    @esmi sorry, I am using a child theme, not editing the parent theme.

    The order in which the widget areas are shown is dictated simply by the order that they appear in the functions.php file. Since your child’s functions.php is called before the parent’s, any widget area you add will always be at the top of the list. To the best of my knowledge, there’s currently no way around this issue.

    If it’s not been mooted on https://www.ads-software.com/extend/ideas/ (and I can’t find it if it has) it might be worth suggesting some sort of dynamic sidebar priority or ordering option as a new feature. As we see more & more child theme development, I think this would be a nice addition. I’d vote for it.

    Thread Starter zeaks

    (@zeaks)

    Thanks for the info.

    If I could even rename the first default widget area to something else, that would be fine.

    Or

    Is there anyway to remove the function, then re-add it including the extra widget area, then position it that way in the child theme?

    You could un-register all of the Twenty Eleven sidebars and then re-register them in your child’s functions.php file in the correct order.

    Thread Starter zeaks

    (@zeaks)

    Thanks, i’ll try that.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Twenty Eleven extra widget area’ is closed to new replies.