Add link in header without sitewide in WP

Discussion in 'WordPress' started by Ibn Juferi, Jan 8, 2009.

  1. #1
    Hello, I am trying to figure out how to add a link in the navigation menu of my WordPress theme (in header.php) and making it appear only on the homepage and not sitewide as it usually is. Is that even possible and how do you do that? Any help would be appreciated. Thanks.
     
    Ibn Juferi, Jan 8, 2009 IP
  2. mann3r

    mann3r Peon

    Messages:
    1,416
    Likes Received:
    100
    Best Answers:
    0
    Trophy Points:
    0
    #2
    dont know if this will work,
    <?php if (is_home()) { ?> <a href="your link here">name</a>
    PHP:
     
    mann3r, Jan 8, 2009 IP
  3. deluxdon

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

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #3
    Use below given code in header.php where you want this link.

    <?php if ( is_home() || is_page() ) { ?>
    [COLOR="Navy"]Your link details[/COLOR]
    <?php } ?>
    Code (markup):
    DON.
     
    deluxdon, Jan 8, 2009 IP
    nitinleew likes this.
  4. Ibn Juferi

    Ibn Juferi Prominent Member

    Messages:
    6,221
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    310
    #4
    Yes, the code worked! Thanks guys :D
     
    Ibn Juferi, Jan 9, 2009 IP