horizondml
Member
Posted 6 months ago #
Here's my problem...
When you create a new custom post type with register_post_type() you can set your post type to has_archive=true so that when you visit mydomain.com/custom_post_type_slug it displays an archive of all your posts for that particular custom_post_type.
At the same time, if you go to mydomain.com/category/category_slug WordPress displays an archive of all the "posts" from that particular category.
So why is it so difficult to access "posts" from ALL categories via a simple URL...is there a method similar to mydomain.com/category/all which would help me to achieve this??
horizondml
Member
Posted 6 months ago #
For anyone interested, this I what I ended up using
//make news page use archive template
add_filter('template_include', 'force_news_use_archive_template');
function force_news_use_archive_template($init) {
global $post;
if ($post->post_type == 'post' && !is_single()) {
return dirname( __FILE__ ).'/archive.php';
}
return $init;
}
You still need a "dummy" page to display the posts in, which is not particularly intuitive, but this seems to be the best workaround.
Now if you visit mydomain.com/dummy_page you see the "posts" archive