By default, WordPress post management section does not include a feature to display images. In this article, ItsmeIT will provide you with two methods to add featured thumbnail to post column WordPress Admin, which will enhance the visual appeal and aesthetics of your posts.
Plugin Add Featured Thumbnail to Post Column WordPress Admin [+ Code]
If you are comfortable with adding code to WordPress, ItsmeIT provides steps on how to add the featured image column to the posts management panel. This process involves using specific functions, such as “add_filter” and “add_action”, to achieve the desired result.
add_filter('manage_posts_columns', 'add_thumbnail_column', 10, 1); function add_thumbnail_column($columns) { $new_columns = array(); $new_columns['thumbnail'] = __('Thunbnail', 'text-domain'); $columns = array_merge($new_columns, $columns); return $columns; } add_action('manage_posts_custom_column', 'display_thumbnail_column', 10, 2); function display_thumbnail_column($column, $post_id) { if ($column === 'thumbnail' && has_post_thumbnail( $post_id )) echo get_the_post_thumbnail($post_id, array(120, 9999)); }
The “add_filter” function can be used to add a filter for displaying the add featured thumbnail to post column WordPress Admin in the post management page. Additionally, the “add_action” function can be used to register a function that will be executed when the new column is added.
The “add_thumbnail_column” function is used to define a new profile picture column and add it to the list of columns displayed in the post management page.
The function “display_thumbnail_column” is responsible for displaying the featured thumbnail in a new column, which is added to the post management page in WordPress. This function checks if the current column is a thumbnail column and if the post has a featured thumbnail. If the conditions are met, the function will retrieve the featured thumbnail of that post and display it in the new column.
Reference hook: developer.wordpress.org
How to Display Thumbnail Images to WordPress Admin Post with Code
To use the above code, you can open and add the code to the functions.php file.
After following the steps above, you will see the featured thumbnail column added to the post manager table on the WordPress admin page. If a post has an image, you will see it displayed in the thumbnail column.
However, when an article image is added and displayed on mobile devices in the article management section of the WordPress admin, it may not appear optimized. To only display the image on desktop, you can add the condition “!wp_is_mobile()” to your code. The resulting code will look like this:
class thumbnailPostAdmin { function __construct() { add_action('init', array($this, 'thumbnailPostAdmin'), 99); } public function thumbnailPostAdmin() { if (!wp_is_mobile()) { add_filter('manage_posts_columns', 'add_thumbnail_column', 10, 1); function add_thumbnail_column($columns) { $new_columns = array(); $new_columns['thumbnail'] = __('Thumbnail', 'text-domain'); $columns = array_merge($new_columns, $columns); return $columns; } add_action('manage_posts_custom_column', 'display_thumbnail_column', 10, 2); function display_thumbnail_column($column, $post_id) { if ($column === 'thumbnail' && has_post_thumbnail( $post_id )) echo get_the_post_thumbnail($post_id, array(120, 9999)); } } } } new thumbnailPostAdmin();
Download the Plugin to Add Post Image Display Function in WordPress Admin
This way, you don’t need to write any code, making it suitable for those who aren’t familiar with coding. You can download the plugin to add featured thumbnail to post column WordPress from the link below and install it. Additionally, ItsmeIT has added a “Filter” setting function in the plugin to enable/disable the image display and fix the image display issue on mobile devices.
After you download it, login to the Admin page, navigate to Plugins->Add new->Upload Plugin find the downloaded zip file and install the plugin.
– Advertising –