Add a filter to the list of post types which can support an admin column

This commit is contained in:
Robin Cornett
2020-02-05 12:42:28 -05:00
parent e5cbdc2289
commit 6a791798f9
@@ -44,14 +44,7 @@ class Display_Featured_Image_Genesis_Admin {
* @since 2.0.0 * @since 2.0.0
*/ */
protected function set_up_post_type_columns() { protected function set_up_post_type_columns() {
$args = array( $post_types = $this->get_post_types();
'_builtin' => false,
'show_ui' => true,
);
$output = 'names';
$post_types = get_post_types( $args, $output );
$post_types['post'] = 'post';
$post_types['page'] = 'page';
foreach ( $post_types as $post_type ) { foreach ( $post_types as $post_type ) {
if ( ! post_type_supports( $post_type, 'thumbnail' ) ) { if ( ! post_type_supports( $post_type, 'thumbnail' ) ) {
continue; continue;
@@ -62,6 +55,24 @@ class Display_Featured_Image_Genesis_Admin {
} }
} }
/**
* Get a list of post types which can show a featured image column.
*
* @return array
* @since 3.2.1
*/
private function get_post_types() {
$args = array(
'_builtin' => false,
'show_ui' => true,
);
$post_types = get_post_types( $args, 'names' );
$post_types['post'] = 'post';
$post_types['page'] = 'page';
return apply_filters( 'displayfeaturedimagegenesis_admin_column_post_types', $post_types );
}
/** /**
* Set up featured image column for users * Set up featured image column for users
* *