Tuesday, November 18, 2014

How to Add a Featured Image Column to WordPress Dashboard

Recently, We can see the default post listing on the WordPress dashboard including different columns, including title, author, categories, tags and so on. But If you want to see the featured thumbnail image on your WordPress dashboard, you need to edit that specific post.

In this blog, I am going to explain you how to add an additional featured image column to the default post listing.

Check out the below code and paste it inside your functions.php file.

//Add a Featured Image Column to WordPress Dashboard
add_filter('manage_posts_columns', 'posts_columns', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);
function posts_columns($defaults){
    $defaults['riv_post_thumbs'] = __('Featured Image');
    return $defaults;
}
function posts_custom_columns($column_name, $id){
        if($column_name === 'riv_post_thumbs'){
echo the_post_thumbnail(array(100,100));
    }
}


0 comments:

Post a Comment