• I’m working with a theme in which the sidebar names are not sidebar 1, sidebar 2, etc., as they appear in the widgets panel. i’ve defined several custom sidebars that are pulled up for specific categories. i named the custom sidebars after the originals, for example, rmiddle-4.php after rmiddle.php (rmiddle-4 is called up in the category 4 template).

    i know that a sidebar function in the function.php file dictates the number of sidebars displayed on the widgets panel. but i can’t figure out how the numbered sidebars that appear on the widgets page correspond to the theme’s named sidebars, or to my additional, custom-named sidebars. can someone please break this down? thanks much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am not sure I understand the question.
    In the functions.php of the theme you should use the names of your sidebars – to make it easy to recognize them in the widgets page.

    In a theme I made I had
    leftbar.php
    sidebar.php (this goes to the right side by default in my design); and then at a certain point I had to divide the [right] sidebar in two, so I created
    rightleft.php
    rightright.php

    In the functions.php I used these names to make sure the blogger will know which sidebar portion is edited when dragging the widgets:

    register_sidebar(array('name'=>'leftbar',
    ...
    register_sidebar(array('name'=>'rightsidebar',
    ...
    register_sidebar(array('name'=>'rightleft',
    ...
    register_sidebar(array('name'=>'rightright',
    etc.

    (but maybe I misunderstood your question)

    Thread Starter thebradmiskell

    (@thebradmiskell)

    no, that’s very helpful. thank you.

    in the meantime, i’ve gained some understanding of where in a sidebar’s php code (at least in the code of the theme i’m adapting) the corresponding number of the sidebar can be found or should be placed. in other words, which sidebar in the presentation>widgets panel any given sidebar.php refers to. the first lines of code on my sidebar.php files read (for example):

    <div id=”sidebar3″>

    <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(3) ) : else : ?>

    It’s the “3” within the parenthesis that dictates which of the sidebars currently generated by my theme’s functions .php file is referred to.

    [[[[The code I’m talking about in my functions.php file is:

    if ( function_exists(‘register_sidebars’) )

    register_sidebars(10, array(

    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,

    ‘after_widget’ => ‘</div>’,

    ‘before_title’ => ‘<h2>’,

    ‘after_title’ => ‘</h2>

      ‘,

    ));
    ]]]]

    I don’t know if I’m being clear enough to help anyone whom might have a similar problem. I can try again if need be.

    again, moshu, thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘custom sidebar naming conventions’ is closed to new replies.