做错了事,搞不清楚是什么。。非常感谢您的帮助!
我有一个自定义的帖子类型,我想在permalink结构中添加查询变量。。到目前为止还不错。。。。
这是wordking right:http://allehondenrassen.nl/kennel?artist=queen&genre=pop
这不起作用:http://allehondenrassen.nl/kennel/queen/pop/
in my archive-kennels.php I added:
echo get_query_var(\'artist\');
echo get_query_var(\'genre\');
In functions.php I added:
add_filter(\'page_rewrite_rules\', \'dvd_rewrite_rules\');
function dvd_rewrite_rules($rules)
{
global $wp_rewrite;
// custom post type name
$dvd_post_type = \'kennels\';
$dvd_rule = array(
// Custom Rewrite Slug = kennel
\'kennel/(.+)/(.+)/?\' => \'index.php?post_type=\' . $dvd_post_type . \'&artist=$matches[1]&genre=$matches[2]\'
);
return array_merge($dvd_rule, $rules);
}
add_filter(\'query_vars\', \'dvd_query_vars\');
function dvd_query_vars($vars)
{
$dvd_vars = array(
\'artist\',
\'genre\'
);
return array_merge($dvd_vars, $vars);
}
玩了几个小时,但看不出问题所在。。。提前感谢!Bas公司