DEV Community

Cover image for Adding Featured Images to your Wordpress admin columns
SeanAUS120
SeanAUS120

Posted on • Updated on

Adding Featured Images to your Wordpress admin columns

A little Wordpress snippet to show the thumbnails in the Wordpress Admin columns. I feel like Wordpress probably could really allow us an interface to customise the heck out of the admin columns as they don't always show the data you want for more complex sites.
We are using this on UCG and Sales Tax USA to track which posts have good CTR on their featured images.

Just add it to your Functions.php and it will appear in your admin.

add_filter('manage_posts_columns', 'posts_columns', 1);
add_action('manage_posts_custom_column', 'posts_custom_columns', 1, 2);
function posts_columns($defaults){
    $defaults['seanaus120_post_thumbs'] = __('Thumbs');
    return $defaults;
}
function posts_custom_columns($column_name, $id){
    if($column_name === 'seanaus120_post_thumbs'){
        echo the_post_thumbnail( 'thumbnail' );
    }
}
Enter fullscreen mode Exit fullscreen mode

Currently in use at:
NYC Posters
Gorilla Printing
Gorilla Printing
Wine N Liquor
Wheatpaste Posters
Wild Posters
UCG
ReWorder
PLA
SignsCity
WildPosters
SalesTaxUSA
WineVybe
Sales Tax API

Top comments (0)