The MU forums have moved to WordPress.org

Repost: Please help with sidebars not showing (1 post)

  1. rcwatson
    Member
    Posted 14 years ago #

    1) I checked the FAQ
    2) I read the Codex
    3) I posted here

    But I still can't get this working. Any help you can give would be much appreciated!

    I have a set of sidebars that I want to display in a grid of 2 rows by four columns underneath the main content on the page. There is also a right-hand sidebar. They're each being added and controlled via Appearance > Widgets.

    I can only get one sidebar (right-hand sidebar) to show up, though.

    Here's my setup:

    sidebar1.php - sidebar9.php

    sidebar1.php contains the right-hand sidebar:

    <div class="art-sidebar1">
    <?php if (!art_sidebar('Right Sidebar')): ?>
    <?php if ( function_exists ( dynamic_sidebar('Right Sidebar') ) ) : ?>
    
    <?php endif; ?>
    <?php endif ?>
    </div>

    This "Right Sidebar" is the only one I can get to display on the page. The others, defined below, don't display at all no matter what I type into the Widget for each.

    sidebar2.php contains the sidebar in Row 1, Column 1 like this:

    <div class="art-sidebar1">
    <?php if (!art_sidebar('Under Bar R1C1')): ?>
    <?php if ( function_exists ( dynamic_sidebar('Under Bar R1C1') ) ) : ?>
    
    <?php endif; ?>
    <?php endif ?>
    </div>

    sidebar3.php - sidebar9.php are the same as sidebar2.php, except the "R1C1" combination changes according to each sidebar's position.

    Then, in my functions.php file, I have the following:

    if (function_exists('register_sidebars')) {
    	register_sidebars(1, array(
    		'name' => 'Right Sidebar',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">'.'<!--- BEGIN Widget --->',
    		'before_title' => '<!--- BEGIN WidgetTitle --->',
    		'after_title' => '<!--- END WidgetTitle --->',
    		'after_widget' => '<!--- END Widget --->'.'</div>'
    	));
    }
    
    if (function_exists('register_sidebars')) {
    	register_sidebars(1, array(
    		'name' => 'Under Bar R1C1',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">'.'<!--- BEGIN Widget --->',
    		'before_title' => '<!--- BEGIN WidgetTitle --->',
    		'after_title' => '<!--- END WidgetTitle --->',
    		'after_widget' => '<!--- END Widget --->'.'</div>'
    	));
    }

    ...and so on for each row/column "cell".

    Finally, here's my setup on page.php to display the grid (this part is NOT working):

    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R1C1');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R1C2');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R1C3');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R1C4');?></div>
    <div class="cleared"></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R2C1');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R2C2');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R2C3');?></div>
    <div style="width:25%;float:left"><?php get_sidebar('Under Bar R2C4');?></div>
    <div class="cleared"></div>

    The problem appears to be with each call to "get_sidebar()". Nothing shows up with that. If I type plain HTML text where the get_sidebar calls are, the text shows up fine.

About this Topic

  • Started 14 years ago by rcwatson