add condition for new post type columns

post_type must be public && support featured image
This commit is contained in:
Robin Cornett
2015-01-01 19:18:24 -05:00
parent 7ff9accb71
commit b04bbb81c6
@@ -45,8 +45,10 @@ class Display_Featured_Image_Genesis_Admin {
$post_types['post'] = 'post';
$post_types['page'] = 'page';
foreach ( $post_types as $post_type ) {
add_filter( "manage_{$post_type}_posts_columns", array( $this, 'add_column' ) );
add_action( "manage_{$post_type}_posts_custom_column", array( $this, 'custom_post_columns' ), 10, 2 );
if ( post_type_supports( $post_type, 'thumbnail' ) ) {
add_filter( "manage_{$post_type}_posts_columns", array( $this, 'add_column' ) );
add_action( "manage_{$post_type}_posts_custom_column", array( $this, 'custom_post_columns' ), 10, 2 );
}
}
}