Like Button on Wordpress: Additional Header code


/ Published in: HTML
Save to your folder(s)

If you are using Simple Facebook Connect Wordpress plugin, it is better to add this code after changing the og:image value or deleting it. Using this code in your Wordpress Theme header will result in having more meaningful information shown in Facebook profile for anyone clicking the button.
Not having this code will result in having every and any liked article show as the same in the visitors Facebook profile. For example, if a visitor likes 4 different articles they will show the same info on his Facebook profile, which is really useless and repititive.


Copy this code and paste it in your HTML
  1. <meta property="og:title" content="<?php the_title(); ?>"/>
  2. <meta property="og:site_name" content="<?php bloginfo('name'); ?>"/>
  3. <meta property="og:image" content="URL to Post Thumbnail if you are using custom field or remove the line"/>
  4.  
  5.  
  6. If you are using a custom-field for posts thumbnails, you may use this (change the name of the custom field, in this case being thumbnail):
  7.  
  8. <meta property="og:image" content="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>"/>

URL: http://blogs.warwick.ac.uk/ahariri/entry/facebook_like_button/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.