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 hasif ( 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
-
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
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?
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>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.
The topic ‘get_sidebar’ is closed to new replies.