有问题的网页:http://www.cambridgesca.org.uk/ExternalDirectory/searchdirectory/
使用的插件:搜索(&N);滤器
频率是一种自定义分类法。代码插入到函数末尾,如下所示。主题文件夹中的php。
add_action( \'init\', \'register_taxonomy_frequencies\' );
function register_taxonomy_frequencies() {
$labels = array(
\'name\' => _x( \'Frequencies\', \'frequencies\' ),
\'singular_name\' => _x( \'Frequency\', \'frequencies\' ),
\'search_items\' => _x( \'Search Frequencies\', \'frequencies\' ),
\'popular_items\' => _x( \'Popular Frequencies\', \'frequencies\' ),
\'all_items\' => _x( \'All Frequencies\', \'frequencies\' ),
\'parent_item\' => _x( \'Parent Frequency\', \'frequencies\' ),
\'parent_item_colon\' => _x( \'Parent Frequency:\', \'frequencies\' ),
\'edit_item\' => _x( \'Edit Frequency\', \'frequencies\' ),
\'update_item\' => _x( \'Update Frequency\', \'frequencies\' ),
\'add_new_item\' => _x( \'Add New Frequency\', \'frequencies\' ),
\'new_item_name\' => _x( \'New Frequency\', \'frequencies\' ),
\'separate_items_with_commas\' => _x( \'Separate frequencies with commas\', \'frequencies\' ),
\'add_or_remove_items\' => _x( \'Add or remove Frequencies\', \'frequencies\' ),
\'choose_from_most_used\' => _x( \'Choose from most used Frequencies\', \'frequencies\' ),
\'menu_name\' => _x( \'Frequencies\', \'frequencies\' ),
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'show_in_nav_menus\' => true,
\'show_ui\' => true,
\'show_tagcloud\' => true,
\'show_admin_column\' => true,
\'hierarchical\' => true,
\'rewrite\' => true,
\'query_var\' => true
);
register_taxonomy( \'frequencies\', array(\'post\'), $args );
}
“频率”是分级的,“工作类型”不是。
所有职位都分配了频率。
如果我搜索工作类型+频率(每周+招待),我会得到结果(在这种情况下,是2个帖子)。
如果我只搜索工作类型(酒店),我会得到结果。
如果我搜索频率(每周),我会收到一条错误消息(可能是404)。
我还注意到,贴子页面并没有在其元数据中列出频率(贴子创建、标签等)。我不知道失败的查询是否与缺少的元数据有关。
Could you please advise me what code I need to implement (and which file / location it needs to go into) to get the query working on custom taxonomy?
编辑:搜索代码(&E);过滤器插件可以通过github获得,据我所知,解决此问题最相关的部分是
https://github.com/rmorse/search-filter/blob/master/search-filter.php可悲的是,我不是一个代码猴;我能理解简单的命令,但在处理复杂数据时我会迷路。