Jump to content
Sign in to follow this  
gayatriom

Adding Facebook like ONLY to the Homepage Header

Recommended Posts

gayatriom

Hey. Is it possible to add a facebook like button ONLY to the homepage header not the rest of the site? Is there a hook for that? My site is a membership site, so facebook only properly scrapes the homepage.. So i'd like to only show the like button on that page.

Share this post


Link to post
Share on other sites
ricardo

Hi Gayatri! It kind of depends on where you want to place it but you can try any of these: pagelines_before_branding pagelines_inside_top_branding pagelines_inside_bottom_branding pagelines_after_branding Ricardo

Share this post


Link to post
Share on other sites
gayatriom

Hey I want place it inside the top branding. Right below my logo. Will it be possible to have it only on the homepage tho?

Share this post


Link to post
Share on other sites
ricardo

Then I would try pagelines_before_branding and pagelines_inside_top_branding. Yes it's possible with CSS. You'll need to include the button first. Ricardo

Share this post


Link to post
Share on other sites
gayatriom

So with CSS though how would i remove it from the other pages? wouldn't the button be given the same css name (i don't know what to call it)

Share this post


Link to post
Share on other sites
ricardo

Yes, in a nutshell you declare its "invisibility" everywhere and then make an exception for the home page. As soon as you have the button in the header, I can help you with that. Ricardo

Share this post


Link to post
Share on other sites
gayatriom

Hey Ricardo. So. I figured creating the hook would be easy, but I keep getting an error. This is the hook I created.

//add_action('pagelines_before_branding', 'add_fblike_to_branding');
	
		// function name
		function add_fblike_to_branding(){
			// This hook adds an fb like button inside my header //
			?>
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Ftalentedtenthnetwork.com%2F&layout=standard&show_faces=true&width=450&action=like&font=arial&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
		<?php }
		// end function

Share this post


Link to post
Share on other sites
gayatriom

BUt somehow the like button isn't showing up.. weird. Even tried out different hooks around the branding section. no luck

Share this post


Link to post
Share on other sites
timlinson

This line needs to be uncommented for the hook to actually register (and platformbase needs to be the active theme), but it shouldn't have caused an error. So yes please post a link. `//add_action('pagelines_before_branding', 'add_fblike_to_branding');`

Share this post


Link to post
Share on other sites
gayatriom

hey the link is http://talentedtenthnetwork.com The homepage is open but the rest of the site is login protected. But you should be able to check stuff. So if i uncomment the above line then where does the 'action' come from?

Share this post


Link to post
Share on other sites
gayatriom

Hey! I uncommented the line and there it is! You rock! OK now to figure out css stuff!

Share this post


Link to post
Share on other sites
timlinson

You could use css, but personally I would add a condtional to the function instead. Something like: ` function add_fblike_to_branding() { if(is_front_page()) { ?> <?php } } `

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×