Add new function to return public content types, including built ins

This commit is contained in:
Robin Cornett
2016-04-25 11:50:27 -04:00
parent 14a1b55f99
commit cfcf4404cb
2 changed files with 17 additions and 6 deletions
@@ -117,9 +117,7 @@ class Display_Featured_Image_Genesis_Helper {
* @param $args
*/
public function do_checkbox_array( $args ) {
$built_in = array( 'post', 'page' );
$post_types = $this->get_content_types();
$post_types = array_merge( $built_in, $post_types );
$post_types = $this->get_content_types_built_in();
foreach ( $post_types as $post_type ) {
$object = get_post_type_object( $post_type );
$type_args = array(
@@ -192,7 +190,9 @@ class Display_Featured_Image_Genesis_Helper {
}
/**
* Get all public content types.
* Get all public content types, not including built in.
*
* @since 2.5.0
* @return array
*/
protected function get_content_types() {
@@ -206,6 +206,18 @@ class Display_Featured_Image_Genesis_Helper {
return get_post_types( $args, $output );
}
/**
* Get all public content types, including built in.
*
* @since 2.5.0
* @return array
*/
protected function get_content_types_built_in() {
$built_in = array( 'post', 'page' );
$post_types = $this->get_content_types();
return array_merge( $built_in, $post_types );
}
/**
* Determines if the user has permission to save the information from the submenu
* page.
@@ -436,8 +436,7 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
$new_value['post_type'][ $post_type ] = $this->validate_image( $new_value['post_type'][ $post_type ], $old_value, $label, $size_to_check );
$new_value['fallback'][ $post_type ] = $this->one_zero( $new_value['fallback'][ $post_type ] );
}
$built_ins = array( 'post', 'page' );
$post_types = array_merge( $built_ins, $this->post_types );
$post_types = $this->get_content_types_built_in();
foreach ( $post_types as $post_type ) {
$new_value['skip'][ $post_type ] = $this->one_zero( $new_value['skip'][ $post_type ] );
}