Show Featured Image in Your WordPress Admin Dashboard

Share Your Thoughts

When you are working with a WordPress theme that relies heavily on the use of a featured image, it is helpful having a visual guide showing where you have used them.

I am currently working on a site that uses the WordPress thumbnail as the background image in several places. It’s important that administrators can see whether a featured image has been set on Posts, Pages or custom post types, or some of the theme impact will be lost.

To make things easier, I wanted to show a thumbnail in the Admin dashboard of the featured image that had been set. Rather than use a plugin, I added some code to the functions.php in my theme. I found the code here on crunchify.com. I’m adding it below for my own convenience!

How to add a featured image to the WordPress admin list pages

Open up the functions.php file in your theme and add this code.

add_image_size( ‘crunchify-admin-post-featured-image’, 120, 120, false );

// Add the posts and pages columns filter. They can both use the same function.
add_filter(‘manage_posts_columns’, ‘crunchify_add_post_admin_thumbnail_column’, 2);
add_filter(‘manage_pages_columns’, ‘crunchify_add_post_admin_thumbnail_column’, 2);

// Add the column
function crunchify_add_post_admin_thumbnail_column($crunchify_columns){
$crunchify_columns[‘crunchify_thumb’] = __(‘Featured Image’);
return $crunchify_columns;
}

// Let’s manage Post and Page Admin Panel Columns
add_action(‘manage_posts_custom_column’, ‘crunchify_show_post_thumbnail_column’, 5, 2);
add_action(‘manage_pages_custom_column’, ‘crunchify_show_post_thumbnail_column’, 5, 2);

// Here we are grabbing featured-thumbnail size post thumbnail and displaying it
function crunchify_show_post_thumbnail_column($crunchify_columns, $crunchify_id){
switch($crunchify_columns){
case ‘crunchify_thumb’:
if( function_exists(‘the_post_thumbnail’) )
echo the_post_thumbnail( ‘crunchify-admin-post-featured-image’ );
else
echo ‘hmm… your theme doesn\’t support featured image…’;
break;
}
}

You should now see a new column when viewing your Posts and Pages in list view:

featured image column

Add Column for Featured Images in WordPress

WordPress , ,


What do you think?

It's good to talk!

Your email address will not be published. Required fields are marked *

Please answer before submitting form * Time limit is exhausted. Please reload CAPTCHA.