Wordpress Question

Discussion in 'Programming' started by rochow, Jan 10, 2008.

  1. #1
    I have a site which is all powered by Wordpress. I have a normal sidebar which is contained in sidebar.php.

    On the actual blog section, I want to put archives in the sidebar; however, I only want it on the blog section (and not the rest)

    Does anyone know how I can do this, or where I could find this info? I've seen it done before, just (obviously) can't see their source too see what they've done.

    Cheers
     
    rochow, Jan 10, 2008 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    if you mean by the blog section as the main page ...

    just test : if ( is_home())...
     
    commandos, Jan 10, 2008 IP
  3. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #3
    There are 4 pages:
    - Home
    - About
    - Blog
    - Contact

    So if I use is_home() then will it work for the blog homepage, or the actual homepage homepage?
     
    rochow, Jan 10, 2008 IP
  4. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #4
    If you home is not a wordpress based, how can you get on homepage ?
     
    MeetHere, Jan 10, 2008 IP
  5. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #5
    It will only be on the home page , for the pages you should test with : is_page()

    and i agree with Meethere , your question is a bit confusing ...
     
    commandos, Jan 10, 2008 IP
  6. rochow

    rochow Notable Member

    Messages:
    3,991
    Likes Received:
    245
    Best Answers:
    0
    Trophy Points:
    240
    #6
    Everything is wordpress.

    Homepage is like "welcome to our site" - its not actually displaying any blog posts, and has a different sidebar (sponsors, because its a free site for a charity)

    On the blog section though, want to have archives in the sidebar instead of the sponsors.

    Make sense? If I knew what I was doing it would make more sense!
     
    rochow, Jan 12, 2008 IP
  7. mich_alex

    mich_alex Well-Known Member

    Messages:
    511
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #7
    <?php if (is_home() || is_page()) { ?>
    
    <!-- your archive as mention -->
    
    <?php } else { ?>
    
    <!-- alterante if not home and page -->
    
    <?php }  ?>
    Code (markup):

    or for more multi choice


    <?php if (is_home() || is_page()) { ?>
    
    <!-- your archive as mention -->
    
    <?php } else if (is_category() ||  is_single()) { ?>
    
    <!-- alterante to show thing in cat and single -->
    
    <?php }  ?>
    Code (markup):
    try it out:)
     
    mich_alex, Jan 13, 2008 IP
  8. Ace0

    Ace0 Active Member

    Messages:
    526
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Yes , you have to put your code above the homepage limit in the sidebar.php file....
     
    Ace0, Jan 13, 2008 IP