New Topic

Custom widget areas failing in Pro

Home › Forum › Customization › Custom widget areas failing in Pro

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1688
    StartupWP
    Keymaster

    No need to add the additional function, just register the new widget areas below:

    register_sidebar( array (
    'name' => __( 'Content Widget Area', 'startup' ),
    'id' => 'content-widget-area',
    'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    'after_widget' => "</li>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );

    Like so:

    register_sidebar( array (
    'name' => __( 'Content Widget Area', 'startup' ),
    'id' => 'content-widget-area',
    'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    'after_widget' => "</li>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );
    register_sidebar( array (
    'name' => __( 'Banner Center Widget Area', 'startup' ),
    'id' => 'bannercenter-widget-area',
    'before_widget' => '<div id="%1$s">',
    'after_widget' => "</div>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );
    register_sidebar( array (
    'name' => __( 'Banner Right Widget Area', 'startup' ),
    'id' => 'bannerright-widget-area',
    'before_widget' => '<div id="%1$s">',
    'after_widget' => "</div>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );
    #1689
    osakawebbie
    Participant

    That simplified the code, but didn’t change the symptom. However, I assumed the widget areas weren’t working because nothing was showing in the header – I didn’t check the Admin side (duh!). I don’t know what the situation looked like while I was putting the theme together, but at the moment the widget areas are all there; the reason nothing was showing correctly (and my tagline was appearing in the sidebar, which was crazy), is that at some point WordPress pushed all the widgets “down” two areas from where they were before! So my Banner Center widget was in Sidebar Widget Area, the Banner Right widget was in Left Sidebar Widget Area (which doesn’t actually appear), and my real sidebar widgets were in Right Sidebar Widget Area (which doesn’t appear). I have moved them all back now, and all is well. :-)

    #1692
    StartupWP
    Keymaster

    Yeah, that’s a common quirk with WordPress. Another thing to look out for when making changes and WP gets confused about widgets, is that they’ll be dropped down under Inactive Widgets. So luckily, they’ll never be lost, just need to be rearranged sometimes if you’re registering/unregistering widget areas.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.