admin管理员组文章数量:1295308
How can I create a archive over terms from a custom taxonomy like there is for custom post types? domain/taxonomy
is empty/404, while domain/cpt
shows all posts for that CPT.
I know I could loop true all terms and display them on a "static" page that I make myself and apply with the template page-taxonomy.php
. This does however not allow me to have a "Next page" function as far as I know.
$terms = get_terms( 'taxonomy' );
foreach ( $terms as $term ) {
echo $term->name
}
Is there a way to make a "normal" archive for the terms of a taxonomy? I do not want the posts of the terms/taxonomy, but the terms themself.
How can I create a archive over terms from a custom taxonomy like there is for custom post types? domain/taxonomy
is empty/404, while domain/cpt
shows all posts for that CPT.
I know I could loop true all terms and display them on a "static" page that I make myself and apply with the template page-taxonomy.php
. This does however not allow me to have a "Next page" function as far as I know.
$terms = get_terms( 'taxonomy' );
foreach ( $terms as $term ) {
echo $term->name
}
Is there a way to make a "normal" archive for the terms of a taxonomy? I do not want the posts of the terms/taxonomy, but the terms themself.
Share Improve this question asked Apr 15, 2021 at 20:18 NiklasNiklas 1113 bronze badges 4- You need to look into wphierarchy. Taxonomy template for cpt requires a certain naming of the template file according to the wp template hierarchy. Also, look at my answer in this question. It is very detailed and shows a tax template file hierarchy. Look at step 3 in that post. wordpress.stackexchange/questions/378422/… – user3135691 Commented Apr 15, 2021 at 21:51
- 1 @user3135691 thanks for the reply, but I don't want a archive for CPT but for the taxonomy terms themselves. There is no built-in function for that in WordPress. – Niklas Commented Apr 16, 2021 at 7:43
- You didn't read correctly, I said Step 3, that is exactly what you need, but hey, no read no progress. – user3135691 Commented Apr 16, 2021 at 8:40
- @user3135691 I have tried to reread what you have written, but I still fail to see how it solves my problem. Your answer is to show posts on /taxonomy, and I want to show terms on /taxonomy. Maybe you would try to expand upon it in an answer? – Niklas Commented Apr 16, 2021 at 11:22
1 Answer
Reset to default 1Is there a way to make a "normal" archive for the terms of a taxonomy?
No, there isn't.
All WordPress views are queries for a post or a collection of posts. There's zero built in functionality for an archive of terms, so you would need to implement it yourself (including pagination).
本文标签: custom post typesArchive page for taxonomy terms
版权声明:本文标题:custom post types - Archive page for taxonomy terms 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741614358a2388443.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论