示例-http://codex.wordpress.org/Function_Reference/register_post_type#Example
(确保这些参数为true:
\'publicly_queryable\' => true, \'query_var\' => true,
然后,您可能需要使用此函数才能在函数中包含搜索代码。自定义帖子类型的php:
add_action(\'pre_get_posts\',\'search_filterr\');
function search_filterr($query)
{
if ( !is_admin() && $query->is_main_query() )
{
global $cts,$lang; $arrs=array(); foreach($cts[\'post_Typess\'] as $befefeb) {$arrs[]=$befefeb;}
if ( $query->is_search )
{
$arrs[]=\'post\';
$arrs[]=\'page\';
$query->set(\'post_type\', $arrs );
//include only specific categories
//global $sxvaa,$lang;
//$query->set(\'cat\', \'\' );
}
else
{
$arrs[]=\'post\';
$arrs[]=\'page\';
$query->set(\'post_type\', $arrs );
}
return $query;
}
}