1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to add HomePage Link in Wordpress Blogs??

Discussion in 'WordPress' started by Ragu_007, Aug 24, 2010.

  1. #1
    Hi,

    Can anyone know how to add a home page link in wordpress blogs?

    The link should be visible only in the home page, not in the other pages.

    If any know, then give your ideas.

    Regards,
     
    Ragu_007, Aug 24, 2010 IP
  2. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why do you need a Homepage Link on Home Page And Not in other pages?

    I wonder!

    ~ExP~
     
    extremephp, Aug 24, 2010 IP
  3. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #3
    What is the difference between Sitewide link and HomePage link??

     
    Ragu_007, Aug 24, 2010 IP
  4. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, Sitewide links comes on all pages, and Homepage Links comes only on the Homepage!

    But what exactly do you mean by Adding Home Page Link? Adding A Link on the Home page? Or Adding the Link of Your Home in Home itself? :D :D

    For Putting links on Home page,
    Go to theme editor, take index.php

    And put
    <a href="url.com">Your Text</a> At the right place where you need it!!

    If you want it sitewide, You should add the code on Index.php, PAge.php and single.php!!

    You can also put it in header or footer by putting it in header.php and footer.php!!

    ~ExP~
     
    extremephp, Aug 24, 2010 IP
  5. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #5
    I need my link to be displayed only on the homepage. I don't want to display that link in any other pages.
     
    Ragu_007, Aug 24, 2010 IP
  6. deluxdon

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

    Messages:
    25,480
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #6
    Ok hereyou go.

    Code for homepage link only

    <?php if ( is_home() || is_page() ) { ?>
    [B]Homepage Link[/B]
    <?php } ?>
    Code (markup):
    DON.
     
    deluxdon, Aug 26, 2010 IP
  7. WallaceYeung

    WallaceYeung Notable Member

    Messages:
    3,377
    Likes Received:
    164
    Best Answers:
    0
    Trophy Points:
    230
    Digital Goods:
    1
    #7
    PM me if you have any more question. ;)

    <?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
    Your HomePage Link
    <?php } ?>
    
    Code (markup):
     
    WallaceYeung, Aug 26, 2010 IP
    psharma likes this.
  8. appstacks

    appstacks Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    First open your theme’s functions.php file and paste the following code:

    function home_page_menu_args( $args ) {
    $args['show_home'] = true;
    return $args;
    }
    add_filter( 'wp_page_menu_args', 'home_page_menu_args' );

    Once you have pasted this code, It should add “Home” as an option under the “Pages” widget on the Menu management page so the user can simply check it off as an item to add to their custom menu.
     
    appstacks, Aug 26, 2010 IP
  9. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Why Can We Use the simple HTML Hyperlink on Index.php? :O

    I wonder :(

    ~ExP~
     
    extremephp, Aug 26, 2010 IP
  10. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #10
    I think, it will became a Sidewide link if you add like that. It will not be a HomePage Link.

     
    Ragu_007, Aug 26, 2010 IP
  11. psharma

    psharma Prominent Member

    Messages:
    1,955
    Likes Received:
    85
    Best Answers:
    4
    Trophy Points:
    345
    #11
    Yes!
    You need to specify in the code that it must show the link only when the url is homepage url.
     
    psharma, Aug 26, 2010 IP
  12. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #12

    If We Keep It In Index.php, It will Only be Shown In the HomePage!!

    I bet, Well, Am Not A Newbie to WP :D

    ~ExP~
     
    extremephp, Aug 26, 2010 IP
  13. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #13
    No mate, the link will be shown in all the pages including HomePage. You can check it. I tried as you said. But, it is same like a SiteWide Link.

     
    Ragu_007, Aug 26, 2010 IP
  14. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #14
    I tried this, but i didn't get the result as you mentioned. I can't find "Home" option in my Pages Widget :(
     
    Ragu_007, Aug 26, 2010 IP
  15. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #15
    CAn You Please SHUT UP??

    Placing it in Index.php Will Not Show it On Any other Pages other than Home!!

    First of All, You started this thread since you dont know how to do it, And Now are you teaching me??

    I agree DeluxDon's Wpbased PHP code, But, actually, there is no need of that, if we can place it from Index.php!

    ~ExP~
     
    extremephp, Aug 26, 2010 IP
  16. Ragu_007

    Ragu_007 Well-Known Member

    Messages:
    1,134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    100
    #16
    Cool Mate .. I tried what you said, but i can't able to get it as Homepage link.
     
    Ragu_007, Aug 26, 2010 IP
  17. psharma

    psharma Prominent Member

    Messages:
    1,955
    Likes Received:
    85
    Best Answers:
    4
    Trophy Points:
    345
    #17
    Tried and Agree :)
     
    psharma, Aug 26, 2010 IP
  18. psharma

    psharma Prominent Member

    Messages:
    1,955
    Likes Received:
    85
    Best Answers:
    4
    Trophy Points:
    345
    #18
    Can you show us the homepage URL please ?
     
    psharma, Aug 26, 2010 IP
  19. khaxan

    khaxan Peon

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Their is a simpler method for adding links to sidebar instead of fiddling with php. Their is a simple plugin called "Widget Context". It allows you to show a specific widget at particular places. Install the plugin, add a text widget with your link and set it to appear on homepage only. Voila!
     
    khaxan, Aug 26, 2010 IP
  20. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Well, Thats Great! But Messing with Codes is Fun! :)

    ~ExP~
     
    extremephp, Aug 26, 2010 IP