Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 30, 2011 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/1325454 to your computer and use it in GitHub Desktop.
Save billerickson/1325454 to your computer and use it in GitHub Desktop.
Facebook Like on Genesis
<?php
/**
* Facebook Like on Single Posts - Genesis
*
*/
function facebook_like_single() {
if( is_single() )
echo '<iframe src="http://www.facebook.com/plugins/like.php?href=' . get_permalink() . '&amp;layout=button_count&amp;show_faces=true&amp;width=250&amp;height=20px
&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:250px; height:20px"></iframe>';
}
add_action('genesis_before_post_content','facebook_like_single');
/**
* Facebook Like header code - Genesis
*
*/
function facebook_like_head() {
if(is_single()) { ?>
<meta property="og:title" content="<?php global $post; echo get_the_title($post->ID); ?>"/>
<?php } else { ?>
<meta property="og:title" content="<?php bloginfo('name').' - '.bloginfo('description');?>"/>
<?php } ?>
<meta property="og:image" content="<?php bloginfo('stylesheet_directory');?>/images/logo.jpg"/>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>"/>
<?php
}
add_action('wp_head','facebook_like_head');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment