• Resolved Odenberg

    (@murmelin)


    I have two sidebar. One “sidebar1.php” is called in the index.php with
    <?php include (TEMPLATEPATH . ‘/sidebar1.php’); ?>

    The second side bar is called in the page.php with
    <?php include (TEMPLATEPATH . ‘/sidebar2.php’); ?>

    I also have this in the fuctions.php:
    ( function_exists(‘register_sidebars’) )
    register_sidebars(2);

    So far so good. In Appearence/Widgets the to sidebars show up and I put the Category widget to sidebar1 and Show Pages widget in sidebar2.

    But still, when I look at a Page, it is Categories that shows up in the sidebar, not the Page as I want.

    It is my own built theme and I have never had this problem with the sidebars before.
    Please help me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Odenberg

    (@murmelin)

    Anyone? Please, I really nedd some help…

    This may help, prob have to add some args to make them unique.

    Thread Starter Odenberg

    (@murmelin)

    Thanks a lot! Now it works!

    I replaced the code in my first post with:
    index.php
    <?php if ( !function_exists(‘dynamic_sidebar’)
    || !dynamic_sidebar(‘sidebar1’) ) : ?>
    <?php endif; ?>

    page.php
    <?php if ( !function_exists(‘dynamic_sidebar’)
    || !dynamic_sidebar(‘sidebar2’) ) : ?>
    <?php endif; ?>

    functions.php
    ( function_exists(‘register_sidebar’) )
    register_sidebar(array(‘name’=>’sidebar1’,));
    register_sidebar(array(‘name’=>’sidebar2’,));

    BUT, since my sidebar1.php and sidebar2.php is no longer in use, all my styling disappeared. And now I dont have any div ids/classes to style in my css. So how can I apply my old styling to the sidebars?

    Thread Starter Odenberg

    (@murmelin)

    Okey. I missunderstood how to do it, and here is the very solution:

    STEP 1: functions.php
    Register the sidebars in the function.php like this:
    ( function_exists(‘register_sidebar’) )
    register_sidebar(array(‘name’=>’sidebar1’,));
    register_sidebar(array(‘name’=>’sidebar2’,));
    register_sidebar(array(‘name’=>’sidebar3’,));

    STEP 2: index.php / page.php / category.php
    Call the sidebar.php (or sidebar2.php if you have more than one sidebar template)
    <?php include(“sidebar.php”); ?>

    STEP 3: sidebar.php
    Create a div and add the widgetized sidebar you want to call with:
    <?php if ( !function_exists(‘dynamic_sidebar’)
    || !dynamic_sidebar(‘sidebar1’) ) : ?>
    <?php endif; ?>

    STEP 4: css file
    Style the div where you put the ‘dynamic_sidebar’

    Swanson, THANKS A LOT for pointing me in the right direction.

    create functions ‘index_sidebar_style’ and ‘page_sidebar_style’, which are just CSS.

    Call each as required (CSS should not be in the body – accomplish with if index if page?):

    <?php include('index_sidebar_style') ?>
    <?php include('page_sidebar_style') ?>

    Example:

    <?php function page_sidebar_style() {  ?>
    <style type="text/css">
    table {
    border: 1px dashed black;
    background: #95EAFE;
    text-align:left;
    width:610px;
    }
    </style>
    <?php }  ?>

    Might need some tweaking but the basic concept is shown above.

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

The topic ‘Problems with widgets in multiple sidebars’ is closed to new replies.