DevWebProIN Newsletter:
Last Updated:


Get Your Site Submitted for Free in the World's Largest B2B Directory!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions


Making Your Blog Digg And Facebook Friendly

By Michael Gray
Expert Author
Article Date: 2009-08-10

If you're involved with social media sites like Digg, Facebbok or Reddit, you've probably seen stories with images next to them. If you've submitted stories there, you may have seen it present you with a few image choices, sometimes the one you want is there sometimes it isn't.

Then there's the the case where the social media site chooses the image on it's own, and it's a crappy image or worse yet an ad … dooming your story to failure. Did you know there's a way to fix that problem?

Many social media sites like Digg and Facebook work with what's called the facebook share standard, so you can tell these services which image you'd prefer they use. This tutorial deals specifically with Thesis, but again can be used on any wordpress blog, but remeber things are just easier with thesis:-)

We need to open up custom_functions.php and add the following code:
// facebook connect digg social media image
function get_social_img() {
global $post;
if ( is_single ()){
$image = "";
$image = get_post_meta($post->ID, 'thesis_post_image', $single = true);
?>
<link rel="image_src" href="<?php echo $image; ?>" />
<?
}
}


The code is pretty small and easy so I'll walk you through it.
  1. We create a new function named - get_social_img

  2. global $post; let's us get all the data

  3. if ( is_single ()) says only execute this code on a single post

  4. we then get the thesis_post_image for this post

  5. and write it to the HTML code.

Now we have to tell thesis where and when to execute the function, we do that by adding this to custom_functions.php

add_action('wp_head', 'get_social_img');

You may not have seen wp_head before, it's a built in wordpress shortcode that tells it to execute this code in the head area of the page. That's it easy as pie. You could improve the code, by maybe adding an if/then to chose the thumbnail over the big picture, or maybe see if there is a special field and then fail over to thumbnail or main image. I think this funtionality should be added to the next version of thesis, if you agree let them know (wink wink nudge nudge).  if you enjoyed this post check out some of my other thesis tutorials.

Comments

About the Author:
Michael Gray is SEO specialist and publishes a Search Engine Industry blog at www.Wolf-Howl.com. He has over 10 years experience in website development and internet marketing, helping both small and large companies increase their search engine visibility, traffic, and sales. Michael is a current member of Internet Marketing of New York ( IM-NY.org) and a guest speaker on Webmaster Radio. He is also an editor for the popular search engine new website Threadwatch.org.



Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact | Site Map

DevWebProIN is an iEntry, Inc.® publication - All Rights Reserved Privacy Policy and Legal
Making Your Blog Digg And Facebook Friendly