无法获取在 Wordpress 中使用的自定义分类 url

发布于 2024-10-07 06:13:35 字数 966 浏览 6 评论 0原文

正如标题所说,

我尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你另情深 2024-10-14 06:13:35

好吧,我发现了我的错误,无论出于何种原因,永久链接下的类别库都必须设置为某些内容,即使它只是默认值!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文