0

I create a custom post type name 'Blog' and Taxonomy is 'Category'. and i also create archive page 'archive-blog.php' to show all custom post. When i click 'mydomain.com/blog' show all custom post.

All the post have some category. But my question how i show my custom post by category

when i enter 'mydomain.com/blog/[my category name]', is not work. what is the valid url that show post only by category

  • Do you mean you have created custom category taxonomy or that you have applied native categories to your CPT? – Rarst Jul 12 '14 at 14:09
  • I applied native categories to my CPT – user3670792 Jul 14 '14 at 5:10
0

There is no concept natively of archive for intersection of specific custom post type with specific taxonomy.

There are multiple approaches here, but all will take some tinkering:

  • you can adjust category term archives to include your CPT (via pre_get_posts hook)
  • you can extend custom post type archives with endpoint to filter them by category
  • probably more ways, it gets pretty arbitrary outside of native functionality

In your specific case I find it a little strange that CPT in question is a "Blog", since that's what native posts already are (and likely easier to go with for, well, blog).

  • i think my question is not clear for all. I need to show category wise posts for custom post type in wordpress. I have tried a lot with the code, but yet no result. Is there any way to display posts category wise for custom post type in wp. Normal post can be show easy way by category or tags wise. But how i show in custom post type. – user3670792 Jul 17 '14 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.