Where to place my sidebar code

Discussion in 'HTML & Website Design' started by raymond222, Jul 8, 2008.

  1. #1
    Can someone tell me where to add my wordpress sidebar code, so the sidebar appears on the left?
    I took a theme with no sidebars, created my sidebar and everything, but can not figure out where call it
    <div align="left"><?php get_sidebar(); ?></div>
    PHP:
    So far its either on top or on bottom of the whole text.
    Any ideas?

    Thanks!
     
    raymond222, Jul 8, 2008 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your sidebar is going to appear to the left, place the code directly beneath the header. To the right, directly above the footer.
     
    Altari, Jul 8, 2008 IP
  3. BANAGO

    BANAGO Active Member

    Messages:
    456
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    You have to work on CSS.
     
    BANAGO, Jul 8, 2008 IP
  4. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #4
    This isn't always the case.

    Logically, you'd want to position the sidebar as low as possible in the source code to let searchbots read through the main page content first. In that case, you'll use floating divs to posion your content blocks, no matter if your sidebar is designed to be on the left or on the right, you can still place it underneath the main content code block.
     
    Clive, Jul 8, 2008 IP
  5. yankzilla

    yankzilla Peon

    Messages:
    159
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Add the following to your CSS for your div calling the sidebar:
    float: left
    Code (markup):
     
    yankzilla, Jul 8, 2008 IP
  6. badnmad

    badnmad Peon

    Messages:
    4
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Place this div tag <div class="sidebar">YOUR SIDEBAR CODE</div> within your sidebar.php file.

    Add this to your CSS file, if you have one.

    
    .sidebar {
        float: left;       /* Puts the sidebar on the left side of the page */
        width: 180px;      /* You can change your sidebar size */
    }
    Code (markup):
    In your index.php file place <?php get_sidebar(); ?> above the footer.

    Hope this helps :D
     
    badnmad, Jul 8, 2008 IP
    viitols likes this.
  7. raymond222

    raymond222 Active Member

    Messages:
    287
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Thanks all!
     
    raymond222, Jul 8, 2008 IP