0

How can I show all the CPT ( Custom Post Type ) posts in one single page? I can view a single CPT post using single-{CPT name}.php file but I am unable to use the archive-{CPT name}.php

I have a CPT as DProject and lets say I have one CPT post SPINNER

www.localhost.com/DProject/SPINNER is visible just like single post but what I want is

www.localhost.com/DProject to show all the CPT posts in one single page just like default post using index.php and the loop.

Please Help.

  • Did you flush your permalinks? – Andrew Bartel Oct 11 '13 at 23:05
1

I think you can do this if you think through how the template hierarchy works carefully enough.

  • archive-post.php should handle your standard post post types
  • archive.php would then handle the rest of the archives
  • You may want specialized category-- category.php
  • or tag archives-- tag.php

A similar pattern should work for single post display.

  • single-post.php should handle your single post post type
  • single.php should handle everything else

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.