WordPress.org

Ready to get started?Download WordPress

Forums

trouble with two sidebars (1 post)

  1. jaw23
    Member
    Posted 4 years ago #

    I am in the process of creating my first theme.

    My homepage has one left sidebar which I have put in a file called: sidebar-h.php and it displays nicely.

    I would like to put two different sidebars on the other pages (one on the left, and one on the right with the main text in the center). I have tried to put them both in sidebar.php but the right sidebar is not displaying.

    sidebar.php page:
    <div class="left">
    <div class="container">
    <h2>recent posts</h2>

    </div>

    <h4>Advertisements</h4>
    <?php /* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    <p> </p>
    <?php endif; ?>
    </div>

    <div class="right">
    <div class="container">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Right Sidebar') ) : else : ?>
    <?php wp_list_bookmarks('category=3'); ?>
    </div>
    <?php endif; ?>
    </div>

    <!-- end sidebar.php -->

    Here's the code for my functions.php:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 115, 115, true ); // 115 pixels wide by 115 pixels tall, hard crop mode
    add_image_size( 'single-post-thumbnail', 500, 9999 ); // Permalink thumbnail size

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Left Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Right Sidebar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
    ));

    ?>

    Also, I would like to be able to put widgets on either side of my theme through the widgets section of the admin panel. How do I specify which sidebar (left or right) the widgets go to?

    Any suggestions would be most appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic