Support » Fixing WordPress » Custom Sidebar and custom sidebar id tage help

  • Hello! I have a small issue, mostly with me not completely understanding how WordPress pulls the sidebar id’s.

    <div id="sidebar">
          if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('custom-sidebar') ) :
          endif; ?>
          <div style="width: 2px; height:200px; background-color: #D6D6D6"></div>

    This is the custom sidebar I made, just following this tutorial here:

    The problem with this code is that I have another sidebar, and both use the id sidebar.

    Just a few side questions about sidebars:
    1) When I registered this sidebar in the functions.php file, I have this code:

    if ( function_exists('register_sidebar') ) {
    'name' => 'Custom Sidebar',
    'id' => 'custom-sidebar',
    'description' => 'Appears as the custom sidebar on the left of the page',
    'before_widget' => '<div style="height: 20px"></div><li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>'

    When it says ‘id’=> ‘custom-sidebar’ – what does that refer to? What is that useful for?

    How can I make this sidebar have its own id apart from the already made sidebar id?

    I need a separate one because the formatting will be different.

    Sorry if this is confusing, and thank you for your help

Viewing 1 replies (of 1 total)
  • Any help here?

    I really just want to understand the code listed above. What things link back to and everything.

    Also, what does this mean: li id=”%1$s” class=”widget %2$s”

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Sidebar and custom sidebar id tage help’ is closed to new replies.