Automatically Set Featured Images

I have a love/hate relationship with featured images on WordPress. I love them but I often forget to set them. Usually I am just forgetful and end up publishing posts before I have the feature image set. That is ok for me who knows what I have done and can go back and set the featured image. Not long ago I had a client where the featured image was an essential part of every post and they were regularly forgetting to set the featured image and well they were getting tired of emailing me to fix their posts for them. With that in mind here are some ways to fix your forgetfulness and automatically have a featured image set for you.

Require Featured Image

Require Featured Image
This plugin does not actually set the featured image for you but it does give you some strong reminders that you need to set a featured image and if for some reason you still don’t remember, well it hooks into the publishing button to disable it until you do add a featured image.

Easy Add Thumbnail

No picture to show you how this plugin works since it is so simple. For older posts the featured image is set when the theme first calls the post. If no featured image is set the plugin will set it to the first image it finds in the post. For new posts it does the exact same thing when you publish the post.

Auto Post Thumbnail

Auto Post Thumbnail PRO
The Auto Post Thumbnail plugin is similar to the Easy Add Thumbnail plugin. It tries to generate a featured image from the first image in a post or any custom post type. If the first image doesn’t work it will automatically go to the next image and so on until a featured image is added. This plugin also has a pro version available on CodeCanyon that also offers the ability to add featured images from external images, imported RSS feeds, for old/legacy posts via a single click and auto thumbnail generation for popular video sharing services like YouTube, Vimeo, DailyMotion and more. If the free version works out for you the Pro version is only $7.00 so it might be worth looking into.

Create Your Own

Another option is to create your own plugin or add some code to your theme functions.php file to do this for you automatically. This snippet of code I found on it is actually a modified version from WPForce. I will share the snippet here and you can try it out in your themes functions.php file.

function autoset_featured() {
          global $post;
          $already_has_thumb = has_post_thumbnail($post->ID);
              if (!$already_has_thumb)  {
              $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
                          if ($attached_image) {
                                foreach ($attached_image as $attachment_id => $attachment) {
                                set_post_thumbnail($post->ID, $attachment_id);
      }  //end function
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');

The short version of what the code does. It checks to see if a post has a featured image and if it does not sets it to the first image in the post.

Of course if you are not forgetful you might not have to worry about automatically setting the featured image. For my client I went with adding the snippet of code to their functions.php file and it has been working great since I did it. Not a single email from them because of a missed featured image.

WordPress and Flickr Photos

World of flickr
Attribution-NoDerivs License by msc-???t?????g? (busy)

Photos can add a lot to a blog post, and I know I am not one of the best examples since many, if not most of my blog posts do not have images with them. There are many places that you can find stock photos for your blog, but it still requires going to that website, searching, downloading, uploading to your blog and inserting into your post. When you have limited time to blog you need to make the most of of your time and that does not always include searching around for images.

There is an alternative to doing all of the searching for stock photos for your blog, use photos from Flickr. Many of the photos on Flickr are licensed under a Creative Commons and you can use them to enhance your blogs posts. There are a number of benefits to using photos from Flickr:

  • You have access to great photos from around the world.
  • It can save you bandwidth.
  • It can reduce the requests on your server.

There are several WordPress Flickr plugins available, but the one plugin I am currently testing is the WordPress Flickr Manager. The plugin allows you to manager your entire Flickr account from inside of your WordPress dashboard, including uploading new photos, inserting your photos into your blog posts and search photos that are available to use via the Creative Commons license.

The one feature I wish the plugin had was a better search for Creative Commons photos. The public photo search returns Creative Commons licensed photos but it would be nice to have an option to limit the search to Creative Commons photos that are allowed under various circumstances. For example photos that are allowed to be used commercially.

If you want to merge your Flickr account and make it easy to add Flickr photos to your WordPress blog take a look at the WordPress Flickr Manager. It might be just the thing you are looking for. Oh, and if you are wondering if this means that I will be adding photos to all of my posts now? I’ll try to add a new one occasionally.