Forked from ashokmhrj/show-meta-data-in-admin-list.php
Created
July 30, 2018 14:09
-
-
Save catchsquare/18cc2e62f4711edefaa0da89a3bd17f0 to your computer and use it in GitHub Desktop.
Showing feature image in admin post listing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * WordPress | |
| * Showing feature image in admin post listing | |
| */ | |
| add_filter('manage_posts_columns' , 'ask_custom_columns'); | |
| /*add_filter('manage_{post-type-slug}_posts_columns' , 'ask_custom_columns');*/ | |
| function ask_custom_columns( $columns ) { | |
| $columns = array( | |
| 'cb' => '<input type="checkbox" />', | |
| 'featured_image' => 'Feature Image', | |
| 'title' => 'Title', | |
| 'comments' => '<span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>', | |
| 'date' => 'Date' | |
| ); | |
| return $columns; | |
| } | |
| add_action( 'manage_posts_custom_column' , 'ask_custom_columns_data', 10, 2 ); | |
| /*add_filter('manage_{post-type-slug}_posts_custom_column' , 'ask_custom_columns_data',10,2);*/ | |
| function ask_custom_columns_data( $column, $post_id ) { | |
| switch ( $column ) { | |
| case 'featured_image': | |
| the_post_thumbnail( 'thumbnail' ); | |
| break; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment