I am running into an issue with a custom query for displaying my posts and am having no luck on the Wordpress Forum nor the plugin forum I used to create the Custom Post Type.
Here is an overview...
I have a Custom Post Type "Business" Business CPT has two Custom Taxonomies -- "Business Type" & "County"
I used WP Types plugin to create the Custom Post Type and create a custom field called "Featured" using a checkbox in the admin area.
This checkbox if selected marks a particular entry as "FEATURED"
I am using a plugin called Search&Filter which allows a user to pick a "Business Type" in "County" EG - CAR HIRE in LONDON
This then runs my search.php template with a query which SHOULD...
- Display any "FEATURED" businesses with both Car Hire and London Taxonomies as true.
- Then display the remaining business listing that do not have "Featured" set to true.
So
FEATURED BUSINESS
Daves Car
Remaining Businesses
ABC Cars
123 Cars
etc etc.
At the moment Car Hire has 5 Featured businesses. My query is pulling them all out but not all at the top. It is just adding them in the alphabetical list with the regular business listings.
Its driving me mad and hopefully somebody far greater than me at PHP and Wordpress can help me sort this out.
Here is the query I am currently using
<?php
if (have_posts()): while (have_posts()) : the_post();
$checked_meta = get_post_meta( $post->ID, 'wpcf-featured', true );
if( $checked_meta ) { ?>
<article>
<!--FEATURED BUSINESSES DISPLAY FIRST-->
</article>
<?php } endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata();?>
<hr class="bottom-padding" />
<?php
$posts = query_posts($query_string . '&orderby=title&order=asc');
if (have_posts()) : while (have_posts()) : the_post();?>
<article class="row business-index" id="post-<?php the_ID(); ?>">
<!--Normal Business Listings-->
</article>
<?php endwhile; ?>
<?php endif; ?>
All I want to do is display all "FEATURED" businesses for that particular search FIRST then display the remaining listings.
I am at the end of a very short piece of rope with this now. Hope somebody can save my mind. Hahaha
Thanks
Dan
<article>
tag so either you're showing us a partial of your code or you've neglected to output any info from the featured business here.