2 sidebars, how do i?
-
I have a theme that lists sub pages on the sidebar if they are available. I only want sub pages on some of my pages, so here is what I did to try and fix it. I created a template called “no sub pages” that pulled a sidebar2 instead of the original sidebar. When I do this, i get the following error:
Fatal error: Call to a member function on a non-object in /homepages/1/d248900016/htdocs/wp-content/themes/mushblue-10/sidebar2.php on line 20
I have added this in functions.php:
<?php
function sidebar1(){
include (TEMPLATEPATH . “/sidebar.php”);
}function sidebar2(){
include (TEMPLATEPATH . “/sidebar2.php”);
}if ( function_exists(‘register_sidebar’) )
register_sidebar(array(‘name’=>’sidebar1’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’,
));
register_sidebar(array(‘name’=>’sidebar2’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’,
));
?>Ideas as to where I go next? What am i missing?
I call the 2nd sidebar like this, <?php sidebar2(); ?>
Also, here is the code on the 1st sidebar that pulls the subpages:
-
<h3 class=”sidebartitle”><?php echo $parent_title; ?> <?php _e(‘Subpages’); ?></h3>
<ul class=”list-page”>
<?php wp_list_pages(‘sort_column=menu_order&title_li=&child_of=’. $parent_id); ?>
I just removed that code in sidebar2.
-
<h3 class=”sidebartitle”><?php echo $parent_title; ?> <?php _e(‘Subpages’); ?></h3>
- The topic ‘2 sidebars, how do i?’ is closed to new replies.