Created
October 30, 2011 03:59
-
-
Save billerickson/1325454 to your computer and use it in GitHub Desktop.
Facebook Like on Genesis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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() . '&layout=button_count&show_faces=true&width=250&height=20px | |
&action=like&font=trebuchet+ms&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