How to make a facebook like box only show on the home page?

Discussion in 'WordPress' started by Kurt Whittingham, Mar 19, 2013.

  1. #1
    Hello, i need a little help
    at the moment on my website www.motorbikecentral.com i have a facebook like box in the right hand side and I only want that to show up on the home page then disappear on all other pages and posts.
    is someone able to help me with this?
    my php knowledge is crap and my wordpress knowledge is also pretty bad. so if you can make it pretty simple as im still learning how to get around the code in wordpress!

    Any help will be appreciated
    Thanks Kurt
     
    Kurt Whittingham, Mar 19, 2013 IP
  2. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #2
    open the admin pane and create new side bar and put that facebook code over there. Then you will find one code line. Copy that and open the sidebar.php file. now, here you needs to be write the PHP condition and with the copy code.
     
    creativewebmaster, Mar 20, 2013 IP
  3. addlinkurl

    addlinkurl Well-Known Member

    Messages:
    2,409
    Likes Received:
    129
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    1
    #3
    <?php if( is_front_page() ) : ?>
    facebook code
    <?php endif;?>
     
    addlinkurl, Mar 21, 2013 IP
  4. CharlieL

    CharlieL Active Member

    Messages:
    69
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    55
    #4
    I like the honesty about the state of your knowledge, Kurt!

    Want you want to do is use a conditional tag (if...then...), as addlinkurl has rightly pointed out.
     
    CharlieL, Mar 22, 2013 IP
  5. Mr-R-T

    Mr-R-T Active Member

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    50
    #5
    Use this:

    <?php if( is_home() ) : ?>
    code goes here
    <?php endif; ?>

    http://codex.wordpress.org/Function_Reference/is_home
     
    Mr-R-T, Mar 23, 2013 IP
  6. Clare12345

    Clare12345 Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    You could try putting it in a <div> and then in your css file saying .page-id-xxx { display: none;} for each other page. But this may be not the most straightforward way to do it.
     
    Clare12345, Mar 24, 2013 IP
  7. hibiscustechno

    hibiscustechno Well-Known Member

    Messages:
    163
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    175
    #7
    First remove the same from widget area to prevent it from showing everywhere , then edit index.php in your theme directory , type echo do_shortcode('short_code_of_your_plugin');
     
    hibiscustechno, Mar 24, 2013 IP
  8. Mr-R-T

    Mr-R-T Active Member

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    50
    #8
    He wants to show the box on the homepage only, while that will make it show on all pages.
     
    Mr-R-T, Mar 25, 2013 IP