RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.20% (5.24%*) • Home Loan Fixed: 5.48% (6.24%*) • Fixed: 5.48% (6.24%*) • Variable: 5.20% (5.24%*) • Investment IO: 5.78% (6.81%*) • Investment PI: 5.49% (6.32%*)

WordPress Featured Image Preview In Your Admin Post Menu

WordPress Featured Image Preview In Your Admin Post Menu

If you're a WordPress user, and you're anything like me, you will write a bunch of articles and forget to set the associated featured image. If you manage multiple users you also might find yourself logging in to check others have done the same. The following WordPress function (or plugin) will add a featured image column with an image preview on your 'All Posts' menu in the WordPress administration panel.

Once you have made the necessary modification, your admin panel will look like this:

add_image_size() Function

When an image is uploaded via the WordPress upload tool, it is automatically scaled to various dimensions as defined in your 'Settings ► Media' administration menu (or the custom sizes defined by you or your theme). The problem with this (and its compatibility with our little function) is that we'll reference the raw unscaled (original, larger) image. While the larger image won't distort your page, necessarily, it will increase page-load time. For that reason, we'll use the WordPress the_post_thumbnail() function to create an image size of our choosing that fits nicely into our newly created featured image column. An image dimension of 60x60 seems to work well although you could choose whatever you want.

add_image_size('admin-list-thumb', 60, 60, true);

Related WordPress functions if you're interested in further reading: add_image_size() , get_the_post_thumbnail() , get_post_thumbnail_id() , set_post_thumbnail_size() , has_post_thumbnail() .

The Function

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

1
<?php 
2
/*
3
 WordPress Featured Image Preview In Your Admin Post Menu
4
 http://www.beliefmedia.com/wordpress-featured-image-menu
5
*/
6
 
7
/*
8
 Size & name of featured image
9
*/
10
 
11
add_image_size('admin-list-thumb', 60, 60, true);
12
 
13
/*
14
 Add featured image colum (we'll call it 'Featured')
15
*/
16
 
17
function beliefmedia_add_post_thumbnail_column($cols){
18
  $cols['wp_post_thumb'] = __('Featured');
19
  return $cols;
20
}
21
add_filter('manage_posts_columns', 'beliefmedia_add_post_thumbnail_column', 5);
22
add_filter('manage_pages_columns', 'beliefmedia_add_post_thumbnail_column', 5);
23
 
24
/*
25
 Get scaled featured-thumbnail & display it
26
*/
27
 
28
function beliefmedia_display_post_thumbnail_column($col, $id) {
29
  switch($col) {
30
    case 'wp_post_thumb':
31
      if( function_exists('the_post_thumbnail') )
32
        echo the_post_thumbnail( 'admin-list-thumb' );
33
      else
34
        echo 'Not supported in theme';
35
      break;
36
  }
37
}
38
add_action('manage_posts_custom_column', 'beliefmedia_display_post_thumbnail_column', 5, 2);
39
add_action('manage_pages_custom_column', 'beliefmedia_display_post_thumbnail_column', 5, 2);

If you're happy to use the smallest thumbnail that WordPress creates by default (150x150), or if you're already using smaller dimensions, you could change echo the_post_thumbnail( 'admin-list-thumb' ); on line 32 to echo the_post_thumbnail('thumbnail');, and remove or comment out the add_image_size() function to create a new image.

Download

The version intended to be pasted in your custom functions file is listed as shortcode.


Title: WordPress Featured Image Preview In Your Admin Post Menu (WP Plugin)
Description: Add a featured image column with an image preview on your 'All Posts' menu in the WordPress administration panel.
  Download • Version 0.2, 1.6K, zip, Category: WordPress Plugins (General)
WordPress Shortcodes, (642.0B)    

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  E. Australia Standard Time [ UTC+10, Default ] [ CHECK TO CHANGE ]

  Want to have a chat?
 

RELATED READING

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment