WordPress.org

Ready to get started?Download WordPress

Forums

Change sidebar on each page (2 posts)

  1. pamelafarber
    Member
    Posted 5 years ago #

    Yes I know this is definitely a repeat but I have been reading and testing all these form solutions and my problem is that they are all only pieced together assuming you understand php completely... and so far they don't tell me if I need to make more sidebar.php pages, what they need to contain...

    So I simply want to have a different sidebar on each 'Page' for example: About, Workshops, Parties, etc. I don't care about categories or archives I just want to use it for the subpages.

    I am using the Black 3column Theme v1.0 by http://www.ikovacic.net which has two sidebar pages called l_sidebar.php and r_sidebar.php for left and right but no 'sidebar.php' which all the tutorials refer to.

    Can anyone help me with this as basic as humanly possible. I have tested all kinds of plugin/widgets for sidebar pages and they all royally screw up my template... obviously I haven't a clue what I'm doing!

    Here is the website: http://www.opheliajewellery.com/style that I'm working with.

  2. stvwlf
    Member
    Posted 5 years ago #

    Hi

    Your theme uses the names l_sidebar.php and r_sidebar.php in two files rather than having one sidebar.php So just substitute that name for sidebar.php for any tutorial page that is looking for sidebar.php

    The easiest way I know to do what you want to do is to use a series of IF statements in the sidebar file.

    It looks like this

    <?php if (is_page('about')) { ?>
                 ---- HTML & PHP code goes here
    <?php } ?>
    
    <?php elseif (is_page('workshops')) { ?>
                ---- HTML & PHP code goes here
    <?php } ?>
    
    <?php elseif (is_page('parties')) { ?>
                ---- HTML & PHP code goes here
    <?php } ?>

    You have to figure out what code goes in the HTML & PHP code section. This is the structure of how you have different content in the sidebar of different pages.

Topic Closed

This topic has been closed to new replies.

About this Topic