WordPress.org

Support

Support » Themes and Templates » How do I style a new widget position in twentyeleven child theme

How do I style a new widget position in twentyeleven child theme

  • I’ve successfully followed the instructions in: http://codex.wordpress.org/Widgetizing_Themes
    for creating a new widget position.

    But now I want to style it and I’m completely baffled. The function that registers the new widget:

    register_sidebar( array(
    		'name' => __( 'Home Nugget', 'twentyeleven' ),
    		'id' => 'home-nugget',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    [Please post code or markup snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Works, but of course it uses the standard widget styling, which I want to change. And if I change the aside class to anything else, the widget doesn’t display at all.

    How do I create a unique class for this particular widget?

    Thanks,

    John

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    @esmi

    Forum Moderator

    Try styling on the widget id.

    Add home-nugget to your style.css and style that

    Moderator Michael

    @alchymyth

    Forum Moderator

    what is the code of your new ‘sidebar’, i.e. where you output the dynamic_sidebar() ?

    you could use something like:

    <?php if ( is_active_sidebar( 'home-nugget' ) ) : ?>
    <div id="nugget" class="widget-area">
    <?php if ( !dynamic_sidebar( 'home-nugget' ) ) : ?>
    <?php endif; ?>
    </div>
    <?php endif; ?>

    and then style for instance:

    #nugget aside {...}

    Nice alchymyth! man, I continue to learn so much from you guys. 🙂

    Thanks alchymyth — I think that’ll work!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I style a new widget position in twentyeleven child theme’ is closed to new replies.