无法获取在 Wordpress 中使用的自定义分类 url
正如标题所说,
我尝试在 WordPress 中实现自定义分类法,我遵循了教程 http://net.tutsplus.com/tutorials/wordpress/introducing-wordpress-3-custom-taxonomies/ 通过这封信,我添加分类法的代码是(将其放在插件以及模板函数 php.ini 都无济于事):
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
register_taxonomy( 'operating_system', 'post', array( 'hierarchical' => true, 'label' => 'Operating System', 'query_var' => true, 'rewrite' => true ) );
}
之后我可以向该分类添加术语,并选择它们作为帖子,一切都很好,但无论我尝试什么,我都无法获得列表“标记”的帖子,请自行查看:
http://sandbox.lautr.com/hello- world-2
这里的新术语是操作系统:->操作系统<-
是的,模板有一个taxonomy.php,但看起来根本没有被调用......我真的看不出我做错了什么,我正在使用Wordpress版本3.0.2
编辑:
好的,我发现了我的错误,无论出于何种原因,永久链接下的类别基础都必须设置为某事,即使它只是默认值!
As The Title said,
I tried to implement a custom taxonomy in wordpress, i followed the tutorial http://net.tutsplus.com/tutorials/wordpress/introducing-wordpress-3-custom-taxonomies/ by the letter for that, my code to add the taxonomy is (placed it in a plugin as well as in the templates function php. to no avail):
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
register_taxonomy( 'operating_system', 'post', array( 'hierarchical' => true, 'label' => 'Operating System', 'query_var' => true, 'rewrite' => true ) );
}
After that I can add terms to that taxonomy, and select them for posts, all fine, but whatevery i try, I'm not able to get a listing for the "tagged" posts,s ee for yourself:
http://sandbox.lautr.com/hello-world-2
The new term here would be Operating System(s): -> OS <-
And yes, there is a taxonomy.php for the Template but it looks like its not called at all ... I really can't see what I've done wrong, I'm using Wordpress Version 3.0.2
EDIT:
Okay, i found my mistake, for whatever obscure Reason Category base under permalinks has to be set to something even if its just the default anyway!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我发现了我的错误,无论出于何种原因,永久链接下的类别库都必须设置为某些内容,即使它只是默认值!
Okay, i found my mistake, for whatever obscure Reason Category base under permalinks has to be set to something even if its just the default anyway!