Wordpress Sidebark links only on home page?

Discussion in 'WordPress' started by trosquin, Aug 6, 2009.

  1. #1
    When you put a link in the sidebar, it goes onto every page across your site. How do I only get links to my friends sites on the home page only? Is there a plugin or do I need to do something in the code?
     
    trosquin, Aug 6, 2009 IP
  2. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #2
    I'm not sure if there's a plugin but I use ling categories and conditional tags on my sidebar. I have link categories named sitewide and homepage. In the sidebar I use the code:
    <?php if (is_home()) { ?>
    <?php wp_list_bookmarks('category_name=homepage&title_li=&categorize=0'); ?>
    <?php } else { ?>
    <?php wp_list_bookmarks('category_name=sitewide&title_li=&categorize=0'); ?>
    <?php } ?>
    Code (markup):
    If a link must appear on the homepage and sitewide, I assign it to both categories.

    Here's more on the wp_list_bookmarks tag: http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
     
    qazu, Aug 6, 2009 IP
  3. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,482
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #3
    You just need to below given code in sidebar.php for that.

    DON.
     
    deluxdon, Aug 6, 2009 IP