WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Titling 3 Dynamic Sidebars in the Widget Panel (8 posts)

  1. intricateartist
    Member
    Posted 3 years ago #

    Forgive me if I missed it, I did search first.

    I would like to implement 3 widgetized sidebar areas in my theme. In functions, I have:

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebars(3);
    ?>

    In each area of the theme I want specific sidebars to appear, I insert the respective code:

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
    	<?php endif; ?>

    What I want is to specify a title for it in the widget panel. Right now, the results are three widget areas titled "Sidebar 1" (2 and 3). I would like to be more specific, naming them "Top Right", "Home" and "Blog".

    Can this be done?

    Thanks in advance!

  2. equalmark
    Member
    Posted 3 years ago #

  3. intricateartist
    Member
    Posted 3 years ago #

    YES that's EXACTLY what I was looking for!

    THANK YOU!

  4. intricateartist
    Member
    Posted 3 years ago #

    Wait -- this only allows for one registered sidebar - how do you get multiples?

  5. intricateartist
    Member
    Posted 3 years ago #

    http://codex.wordpress.org/Function_Reference/dynamic_sidebar

    Multiple Sidebars

    You can load a specific sidebar by either their name (if given a string) or ID (if given an integer). For example, dynamic_sidebar('top_menu') will present a sidebar registered with register_sidebar(array('name'=>'top_menu',)).

    How would this be written?

  6. equalmark
    Member
    Posted 3 years ago #

    Something like this:

    register_sidebar(
    			array(
    				'id' => 'belownav',
    				'name' => __( 'Below Main Nav' ),
    				'description' => __( 'This is a widgetized area directly below the sites main navigation.' ),
    				'before_widget' => '<div class="widget belownav">',
    				'after_widget' => '</div>',
    				'before_title' => '<h3 class="widget-title belownav-title">',
    				'after_title' => '</h3>'
    			)
    		);
    		register_sidebar(
    			array(
    				'id' => 'sidebar',
    				'name' => __( 'Sidebar' ),
    				'description' => __( 'This is a widgetized area for the sidebar used on all posts.' ),
    				'before_widget' => '<div class="widget">',
    				'after_widget' => '</div>',
    				'before_title' => '<h3 class="widget-title belownav-title">',
    				'after_title' => '</h3>'
    			)
    		);
  7. intricateartist
    Member
    Posted 3 years ago #

    Got it!

    I was wrapping delimeters around each sidebar and that did not work. Wrapped it around the bundle instead. Perfect.

    Then, inserting this into the area in the template where I want that widgetized area to appear:

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('belownav') ) : else : ?>
    	<?php endif; ?>

    Worked like a charm. Thanks so much!!

  8. equalmark
    Member
    Posted 3 years ago #

    No problem, glad to help :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.