I have 3 differents custom post type : “Projet”, “Notice” and “Disque”. I want them to appear in a specific order when they are listed in the category or the tag template page. Like that :
1 – Notice
2 – Projet
3 – Disque
I’ve tried to catch te query string and use 3 different loops with WP_Query with no results.
<?php $my_notices_query = new WP_Query($query_string.'&post_type=notices&posts_per_page=1'); // only notices… ?> <?php while ($my_notices_query->have_posts()) : $my_notices_query->the_post(); ?>
The query allways show all the cpt with no restriction.
My solution is not working because it is just not filtering the custom post type as I want. To keep getting the wanted tag or category of the initial query, I must keep the
$query_stringin the new query… I think the better solution would be to filter and order that in functions.php but I don’t know how.
And I must say that I already add this code to make appear the cpt in my tag and category template page.
Thks for your help. BR
- The topic ‘How to order different custom post type in category or tag template page?’ is closed to new replies.