WordPress.org

Support

Support » Themes and Templates » get_sidebar

get_sidebar

  • Hello,
    I am having trouble getting my sidebars working properly..
    My templates says

    <?php get_sidebar('left'); ?>
    ..
    <?php get_sidebar('right'); ?>

    and that loads sidebar-left.php and sidebar-right.php that I have defined.
    My functions.php has

    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'name' => 'left',
    		'before_widget' => '<li>',
    		'after_widget' => '</li>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));
    	register_sidebar(array(
    		'name' => 'right',
    		'before_widget' => '<li>',
    		'after_widget' => '</li>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));

    And I see these sidebars named ‘left and ‘right’ show up in widgets menu. I tried adding widgets to the sidebars, but they don’t show up on my sidebars.. where is the problem?

    thanks,
    Slava

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

    @esmi

    Forum Moderator

    What are your sidebar files called? They should be sidebar-left.php and sidebar-right.php.

    As I mentioned in the original post the sidebar files are named sidebar-left.php and sidebar-right.php

    esmi

    @esmi

    Forum Moderator

    Sorry – missed that.

    There’s a missing closing } in your functions.php code. Is that just a copy’n’paste error?

    What’s in your sidebar files?

    miocene22

    @miocene22

    Try removing the final trailing commas for each of the sidebar arrays in functions.php. The last item in the array should not have a comma

    ok. made the changes, but it still does not work..
    functions.php:

    <?php
    if ( function_exists('register_sidebar') ) {
    	register_sidebar(array(
    		'name' => 'left',
    		'before_widget' => '<li>',
    		'after_widget' => '</li>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>'
    	));
    	register_sidebar(array(
    		'name' => 'right',
    		'before_widget' => '<li>',
    		'after_widget' => '</li>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>'
    	));
    }
    ?>

    sidebar-left.php:

    <div id="right_sidebar" class="tRightSidebar">
        <p>
            <img src="<?php echo bloginfo('template_url'); ?>/images/template/tSpacerRightColumn.gif" width="210" height="40" />
        </p>
        <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('right_sidebar') ) : else : ?>
    
                        <?php wp_list_bookmarks('category_before=<div id="tRightColumnInset1">&category_after=</div>&title_before=<h4>&title_after=</h4>&categorize=1&category=2,7,6&orderby=id&category_orderby=id&show_description=0'); ?>
        <?php endif; ?>
    </div>

    sidebar-left.php:

    <div id="left_sidebar" class="tLeftSidebar">
    
    </div>

    esmi

    @esmi

    Forum Moderator

    Try:

    sidebar-left.php:

    <div id="right_sidebar" class="tRightSidebar">
        <p>
            <img src="<?php echo bloginfo('template_url'); ?>/images/template/tSpacerRightColumn.gif" width="210" height="40" />
        </p>
        <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('right') ) : else : ?>
    
                        <?php wp_list_bookmarks('category_before=<div id="tRightColumnInset1">&category_after=</div>&title_before=<h4>&title_after=</h4>&categorize=1&category=2,7,6&orderby=id&category_orderby=id&show_description=0'); ?>
        <?php endif; ?>
    </div>

    sidebar-left.php:

    <div id="left_sidebar" class="tLeftSidebar">
    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('left')) : ?>
    <?php endif;?>
    </div>

    thanks! that worked.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘get_sidebar’ is closed to new replies.
Skip to toolbar