Adding a featured image for each post is important for your website’s beauty & very much for the SEO part.

To make sure all posts have a featured image, use this code to add a thumbnail of the image to the post list in your wp-admin:

function add_thumbnail_to_post_list_data($column,$post_id)
{
    switch ($column)
	{
		case 'post_thumbnail':
			echo '<a href="' . get_edit_post_link() . '">'.the_post_thumbnail( 'thumbnail' ).'</a>';
			break;
    }
}
function add_thumbnail_to_post_list( $columns )
{
    $columns['post_thumbnail'] = 'Thumbnail';
    return $columns;
}

if (function_exists('add_theme_support'))
{
	// Add To Posts
    add_filter( 'manage_posts_columns' , 'add_thumbnail_to_post_list' );
    add_action( 'manage_posts_custom_column' , 'add_thumbnail_to_post_list_data', 10, 2 );

	// Add To Pages
    add_filter( 'manage_pages_columns' , 'add_thumbnail_to_post_list' );
    add_action( 'manage_pages_custom_column' , 'add_thumbnail_to_post_list_data', 10, 2 );
}

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?