'', // javacsript function name in the windows scope | if empty, shows results
'placeholder' => 'Search in post types..',
'search_values' => 0,
'limit' => 10,
'delimiter' => '!!!CPTRES!!!',
'controls_position' => 'right',
'class' => ''
);
function render() {
$post_title = get_the_title($this->value) . " (" . get_post_type($this->value) . ")";
?>
args['class'] : "";?>'
id='wd_cpt_search-'>
args['controls_position'] == 'left') $this->printControls(); ?>
args['controls_position'] != 'left') $this->printControls(); ?>
true,
"_builtin" => false
), "names", "OR");
$post_types = array_diff($post_types, self::$NON_DISPLAYABLE_POST_TYPES);
$asp_query = new SearchQuery(array(
"s" => $phrase,
"_ajax_search" => false,
'keyword_logic' => 'and',
'secondary_logic' => 'or',
"posts_per_page" => 20,
'post_type' => $post_types,
'post_status' => array(),
'post_fields' => array(
'title', 'ids'
)
));
$results = $asp_query->posts;
Ajax::prepareHeaders();
print_r($data['delimiter'] . json_encode($results) . $data['delimiter']);
die();
}
public static function registerAjax() {
if ( !has_action('wp_ajax_wd_search_cb_cpt') ) {
add_action('wp_ajax_wd_search_cb_cpt', array(get_called_class(), 'search'));
}
}
}