Make Thesis Work Better With Digg and Facebook

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.

GraywolfSEO.com runs on the Genesis Framework

Genesis Framework

Genesis lets you to quickly and easily build amazing websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.
It's that simple - start using Genesis now!


Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.


tla starter kit

Advertisers:

  1. Text Link Ads - New customers can get $100 in free text links.
  2. BOTW.org - Get a premier listing in the internet's oldest directory.
  3. Need an SEO Audit for your website, look at my SEO Consulting Services
  4. TigerTech - Great Web Hosting service at a great price.
Read previous post:
Make WordPress Search Engine Friendly

Here are some tips for setting up wordpress and making it more search engine friendly, please feel free to rate...

Is the BlogHer Conference Guilty of Sex Discrimination

Last week July 18th through the 20th was this years BlogHer Conference. According to the Blogher website their mission is:...

Interview with SEOROI Gab Goldberg, Sugarrae, and Stuntdubl

If you've ever wondered hey why should I go an SEO conference what the heck am I going to get...

Close