Wordpress filter by custom type
-
29-09-2019 - |
Question
I am trying to make an index page but just showing the posts of a specific custom type.
Loop starts like this:
<?php while ( have_posts() ) : the_post() ?>
How can I modify the code just to show posts from a custom type called "classifieds"?
Thanks!
Solution
You'd be much better off creating your own query, and by-passing the post type check altogether;
query_posts('post_type=my_post_type');
while (have_posts()):
...
endwhile;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow