我有一个jQuery ui选项卡,可以通过侧栏上的ajax加载帖子。现在在一个特定的页面中,我想通过is_page();
有条件的但就我而言,它不起作用。
function load_home_classifieds($type){
$query = array(
\'post_type\' => \'classified\',
\'posts_per_page\' => 5
);
if(is_page(\'real-estate\')){
//echo \'ok\';
$query[\'tax_query\'] = array(
array(
\'taxonomy\' => \'classified-category\',
\'field\' => \'slug\',
\'terms\' => array( \'real-estate\' ),
\'operator\' => \'NOT IN\'
)
);
}
if($type == \'latest\'){
query_posts($query);
get_template_part(\'loop\', \'cfhome\');
}
elseif($type == \'random\'){
$query[\'orderby\'] = \'rand\';
query_posts($query);
get_template_part(\'loop\', \'cfhome\');
}
else{
echo \'Invalid request!\';
}
}
现在,我的问题是如何在ajax函数中实现条件工作?