• 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://www.ads-software.com/plugins/custom-post-type-ui/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor 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?

    Thread Starter creativemind1

    (@creativemind1)

    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” https://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 Contributor 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?

    Thread Starter creativemind1

    (@creativemind1)

    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 Contributor 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.www.ads-software.com/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.

    Thread Starter creativemind1

    (@creativemind1)

    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.