__get_custom_posts

A utility method that retrieves a collection of posts from a custom post type.

REMINDER

The __get_custom_posts() is a public static method of Handy class. When using this static method, remember to apply the Scope Resolution Operator (::).

Parameters

NameDescription
$post_type

string required

The custom post type name or slug.

Basic Usage

REMINDER

In this example, the select control's choices parameter will be supplied with __get_custom_posts().

 
// Select Control.
Handy::control( 'select', [
    'id'          => 'select_id',
    'section'     => 'layout_section',
    'label'       => esc_html__( 'Select Control', 'textdomain' ),
    'priority'    => 1,
    'choices'     => Handy::__get_custom_posts( 'product' )
]);

Return

TypeValue
array [ 'post_id' => 'post_title', … ]