Move get_post_types to form class

This commit is contained in:
Robin Cornett
2019-06-23 16:46:24 -04:00
parent 20c6cc3128
commit f0451a1184
3 changed files with 23 additions and 23 deletions
@@ -26,6 +26,28 @@ class DisplayFeaturedImageGenesisWidgetsForm {
$this->instance = $instance;
}
/**
* Get the public registered post types on the site.
*
* @return mixed
*/
public function get_post_types() {
$args = array(
'public' => true,
'_builtin' => false,
'has_archive' => true,
);
$output = 'objects';
$post_types = get_post_types( $args, $output );
$options['post'] = __( 'Posts', 'display-featured-image-genesis' );
foreach ( $post_types as $post_type ) {
$options[ $post_type->name ] = $post_type->label;
}
return $options;
}
/**
* @return array
*/