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
Add a comment  | 

1 Answer 1

Reset to default 1

Is 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