Support » Plugin: Custom Post Type UI » Get All Posts of All Categories of Custom Taxonomies of Custom Post Type

  • Resolved creativemind1

    (@creativemind1)


    Hi,

    My custom post type name is blog. I created a custom taxonomy by name cat. I made few categories under that cat taxonomy. Let’s say I’ve ten posts which are assigned to the different categories of the cat taxonomy. I want to call all these into taxonomy category template. I tried creating taxonomy-cat.php but it doesn’t do anything. Can anyone help me with regards to this?

    https://wordpress.org/plugins/custom-post-type-ui/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    As far as I know, that’s a file name that should work. Have you determined what template is being used instead? Are you sure you’re visiting the correct url for this taxonomy archive?

    I think I solved that but I want to know that I’ve created template file archive-blog.php, however still it is taking archive.php template. I visited and check the category of my custom post type taxonomy “cat” http://mydomain.com/cat/category-name/ and I found that it is taking archive.php. Even after creating the archive-blog.php it is still taking archive.php

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    archive-blog.php would only apply for the archive of the custom post type posts, which is different than the taxonomy archive for the terms in the taxonomy.

    Are you sure you’re matching the taxonomy slugs exactly?

    Look, I’m getting confused here..

    My Custom Post type name is blog
    My Taxonomy name is cat
    I made category let’s call “dog” under the taxonomy
    Now, I’ve assigned 10 posts [of custom post type] under the dog category.

    Now, if I want to go to check all the posts of “dog” category, what I’ve to do? In general we have category.php, i think it will not work for the custom post type, we have to use something different.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    if I’m following everything correctly, your taxonomy is set to have an archive (an important detail, but I wager it’s covered already), and you want to see all post that have the term of “dog”, you’d want to go to domain.com/cat/dog/

    That would be the archive url for the “cat” taxonomy and the “dog” term. It should show all the posts that have the term “dog”.

    Further reading regarding hierarchy: https://developer.wordpress.org/themes/basics/template-hierarchy/

    Honestly, I would advise against “cat” for the taxonomy slug as well, because of how query strings work, and the risk of clashing with what WordPress interprets it needs to query for.

    Wow, I was making very bad mistake for having taxonomy by name “cat”. It was indeed effecting somewhere in the website. I sorted that out.

    Superb! Solved my issue. I need to use taxonomy.php for displaying all the posts of that term.

    Thanks Dude!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Get All Posts of All Categories of Custom Taxonomies of Custom Post Type’ is closed to new replies.