Sort by page information by Ascending Numbers

Question

Basically I have a problem that I have details being pulled from advanced custom fields and I currently have them ordered by page title in ascending order.

However, instead of ordering them Ascending by Page Title, I would like to order them by my custom field: *educational_ranking*.

<?php query_posts('post_type=page&post_parent=2&posts_per_page=-1&orderby=&order=ASC'); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<tr>
<td><?php echo the_field('educational_ranking'); ?></td>
<td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
<td><?php echo the_field('current_students'); ?></td>
<td>£<?php echo the_field('tuition_fees'); ?></td>
<td></td>
</tr>

<?php endwhile; rewind_posts(); ?>

Thats what I have so far, I cannot seem to work out how to sort by the field: ‘educational_ranking’ – any ideas?

0
, , , Owen ONeill 7 years 0 Answers 19 views 0

2019's Best Selling WordPress Themes

Leave an answer