WordPress a quelques colonnes d’administration par défaut qui affichent des informations sur vos articles et pages. Vous pouvez également ajouter des vignettes aux colonnes d’administration des articles et des pages, de sorte que vous n’ayez pas besoin d’éditer l’article pour vérifier les images en vedette.
Instructions : Ajoutez le code suivant au fichier functions.php de votre thème WordPress.
if (function_exists( 'add_theme_support' )){ add_filter('manage_posts_columns', 'posts_columns', 5); add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2); add_filter('manage_pages_columns', 'posts_columns', 5); add_action('manage_pages_custom_column', 'posts_custom_columns', 5, 2); } function posts_columns($defaults){ $defaults['wps_post_thumbs'] = __('Thumbs'); return $defaults; } function posts_custom_columns($column_name, $id){ if($column_name === 'wps_post_thumbs'){ echo the_post_thumbnail( array(125,80) ); } }
Vous pouvez également apprécier la suppression de la méta-boîte de l’image vedette.
That’s great! it worked with just copying and pasting that code sinppet on the functions.php file!
Thank you!
[…] [Source] […]
This is a pretty handy snippet, thanks for sharing.
Cool glad you like the snippet,
Thanks for the info. Any idea how to reorder the columns so the thumbnail column is first?
thanks
I’d also like the answer to that. At first I thought that it might be the “5” because it was in the fifth column but I tried changing it and nothing happened.
This is the priority, i.e. when they are executed
http://codex.wordpress.org/Function_Reference/add_filter
http://codex.wordpress.org/Function_Reference/add_action
Thanks for this handy tip. This really benefits our work process in viewing our wordpress posts.
Cool glad to see this helps out.
I’d love to have this check if a featured image shows and work like it does, but if featured images aren’t enabled, display the post’s attached image’s thumbnail. Would that be hard to do?