my situation is I registered a custom post type named 'products'
and I included 'has_archive' => true
in the parameter to enable an archive template for this custom post type, I also created a archive-products.php
as the template for displaying post per taxonomy of 'products'
, but what I noticed is when I enabled 'has_archive' => true
what happens is archive-products.php
acts as the index page template of the 'products'
custom post type instead of the 'page-products.php'
file that I created as the index page template for listing all the post of 'products'
custom post type.
then when I click a link to the product-category
this archive-products.php
uses the default archive.php
as it’s archive page template. it really acts weird and now I don’t know what to do next.
what I want to happen is prevent this from happening and let page-products.php
act as the default index page template for listing the posts (as it should be) and for archive-products.php
to be used by page-products.php
as it should be doing.
thanks I hope someone can help me into this issue.
by the way I’m using WordPress 3.5.1
I faced the same problem in the last days, and take a couple of hours to search for a solution, in my case the solution was to add this following functions to you functions.php file: flush_rewrite_rules(false);
I hope it can help you 🙂
you can check this plugin for your custom post display
wordpress.org/plugins/wp-custom-post-field
on here create your custom post and use shortcode for display post.