Created
September 28, 2017 17:47
-
-
Save norewp/cf4551d00042f82df618efa54c551454 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
// Set featured images size | |
add_image_size( 'designsbynore-admin-post-featured-image', 125, 125, false ); | |
// Add the column | |
function designsbynore_post_list_thumbnail_column($designsbynore_columns){ | |
$designsbynore_columns['designsbynore_thumb'] = __('Featured Image', 'textdomain' ); | |
return $designsbynore_columns; | |
} | |
add_filter('manage_posts_columns', 'designsbynore_post_list_thumbnail_column', 2); | |
add_filter('manage_pages_columns', 'designsbynore_post_list_thumbnail_column', 2); | |
// Get featured-thumbnail size post thumbnail and display it | |
function designsbynore_show_list_thumbnail_column($designsbynore_columns, $designsbynore_id){ | |
switch($designsbynore_columns){ | |
case 'designsbynore_thumb': | |
if( function_exists('the_post_thumbnail') ) { | |
echo the_post_thumbnail( 'designsbynore-admin-post-featured-image' ); | |
} | |
else | |
echo __( 'Your theme does not support featured images', 'textdomain' ); | |
break; | |
} | |
} | |
add_action('manage_posts_custom_column', 'designsbynore_show_list_thumbnail_column', 5, 2); | |
add_action('manage_pages_custom_column', 'designsbynore_show_list_thumbnail_column', 5, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment