Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Featured image column in the posts list

Shows a small thumbnail of each post’s featured image in the posts and pages lists.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category Media
  • Tested with WordPress 7.1
PHP
<?php

add_action(
	'admin_init',
	static function () {
		foreach ( get_post_types_by_support( 'thumbnail' ) as $type ) {
			if ( 'product' === $type || 'attachment' === $type ) {
				continue;
			}
			add_filter(
				"manage_{$type}_posts_columns",
				static function ( $columns ) {
					return array_slice( $columns, 0, 1, true ) + array( 'snipfire_thumb' => __( 'Image' ) ) + $columns;
				}
			);
			add_action(
				"manage_{$type}_posts_custom_column",
				static function ( $column, $post_id ) {
					if ( 'snipfire_thumb' === $column ) {
						echo get_the_post_thumbnail( $post_id, array( 48, 48 ) ) ?: '—'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- WordPress's own image markup.
					}
				},
				10,
				2
			);
		}
	}
);
add_action(
	'admin_head',
	static function () {
		echo '<style>.column-snipfire_thumb{width:56px}.column-snipfire_thumb img{width:48px;height:48px;object-fit:cover;border-radius:3px}</style>';
	}
);

Good to know

WooCommerce products already have their own image column, so products are skipped.

In these packs

  • Images and media: Sharper, lighter images, tidier uploads and a more useful media library.
  • More admin tweaks: Useful columns, a tidier admin bar, a welcome box for clients, and fewer menus for editors.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.