Is there a way I can list all posts in a specific custom post type and arrange them by the custom taxonomy term attached to them?
For example;
Taxonmy Term #1
Post Type
Post Type
Post Type
Taxonomy Term #2
Post Type
Post Type
Any help would be most appreciated.
Thanks.
Try this
We get all the terms of a taxonomy, loop through them, and fire off a title link to each post that belongs to that term. If you need to reorder the taxonomy terms, you can do so with a plugin pretty easily. Reorder Taxonomy, I believe. But pay attention that this plugin adds(!) another column to your table on activation and does not remove it upon deactivation!
Not a particularly elegant solution but you can create multiple queries each for the specific terms and then output them. Hopefully someone can come up with a nicer way of automatically pulling the terms to modify the output/sorting. But this would get you going.
Nice one! GhostOne’s solution was what I had been looking for.
In my situation the custom post type was ‘minining_accidents’ and custom taxonomies associated with this was ‘accident-types’ which had multiple terms under it. My idea was to create a custom widget to show list of posts under terms in this custom taxonomies. In my trial run it got what I wanted. Rest was spruce up. Here is my code:
Yes! There always is an option to further improve the code.
This is long solution i tried before coming to this thread. Hope this may help someone to understand better.
To show a list of custom posts from a custom taxonomy
Title