Reputation: 749
In a page on a complex WordPress site, I need to sort the image icons by the tile of the post the image link leads. Is there a way to get this done in the new WP_Query() below?
$corepage = get_field('purposeful_purveyor_settings', 'option');
$purveyor_ppp = $corepage['purposeful_purveyor_posts_per_page'];
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$data= new WP_Query(array(
'post_type'=>'purposeful_purveyor',
'posts_per_page' => $purveyor_ppp,
'paged' => $paged,
));
<?php if($data->have_posts()): while($data->have_posts()): $data->the_post(); ?>
<div class="col col-xs-12 col-md-6 col-lg-4">
<?php get_template_part('template-parts/purveyor/purveyor--entry'); ?>
</div>
<?php endwhile; ?>
Upvotes: 0
Views: 691
Reputation: 991
You can use the order and orderby properties.
Check WP_Query order and orderby
Upvotes: 1