如何将此函数应用于单个页面ID:
function exclude_jobs_locations($args){
$exclude = "40";
$args["exclude"] = $exclude;
return $args;
}
add_filter("sjb_job_location_filter_args","exclude_jobs_locations");
排除父类别时,我是否也可以排除子类别?
我尝试过:
function exclude_jobs_locations_uk($args){
if( is_page( 2094 ) ) {
$exclude = "40";
$args["exclude"] = $exclude;
}
return $args;
}
add_filter("sjb_job_location_filter_args","exclude_jobs_locations_uk");
但出了点问题。
我使用此函数从以下内容中排除类别:
// Creating list on non-empty job location
$jobloc_select = wp_dropdown_categories(apply_filters(\'sjb_job_location_filter_args\', array(
\'show_option_none\' => __(\'Location\', \'simple-job-board\'),
\'hide_empty\' => 0,
\'name\' => \'selected_location\',
\'orderby\' => \'NAME\',
\'order\' => \'ASC\',
\'class\' => \'sjb-form-control\',
\'hierarchical\' => TRUE,
\'value_field\' => \'slug\',
\'taxonomy\' => \'jobpost_location\',
\'selected\' => $selected_location,
\'echo\' => FALSE,
)));
?>