mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-19 22:43:24 +09:00
Move get_post_types to form class
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user