PHP Class CMB2_Post_Search_field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs
Show file Open project: webdevstudios/cmb2-post-search-field Class Usage Examples

Protected Properties

Property Type Description
$single_instance

Public Methods

Method Description
add_find_posts_div ( ) Add the find posts div via a hook so we can relocate it manually
ajax_find_posts ( ) Check to see if we have a post type set and, if so, add the pre_get_posts action to set the queried post type
get_instance ( ) : CMB2_Post_Search_field Creates or returns an instance of this class.
has_post_search_text_field ( $fields )
render_field ( $field, $escaped_value, $object_id, $object_type, $field_type )
render_js ( $cmb_id, $object_id, $object_type, $cmb )
set_post_type ( array $query ) Set the post type via pre_get_posts

Protected Methods

Method Description
__construct ( )

Method Details

__construct() protected method

protected __construct ( )

add_find_posts_div() public method

Add the find posts div via a hook so we can relocate it manually
public add_find_posts_div ( )

ajax_find_posts() public method

Check to see if we have a post type set and, if so, add the pre_get_posts action to set the queried post type
public ajax_find_posts ( )

get_instance() public static method

Creates or returns an instance of this class.
Since: 0.2.4
public static get_instance ( ) : CMB2_Post_Search_field
return CMB2_Post_Search_field A single instance of this class.

has_post_search_text_field() public method

public has_post_search_text_field ( $fields )

render_field() public method

public render_field ( $field, $escaped_value, $object_id, $object_type, $field_type )

render_js() public method

public render_js ( $cmb_id, $object_id, $object_type, $cmb )

set_post_type() public method

Set the post type via pre_get_posts
public set_post_type ( array $query )
$query array The query instance

Property Details

$single_instance protected static property

protected static $single_instance