Sort posts by custom field with number
-
I’m using the following query:
<?php $args = array( 'meta_key' => 'hm-slider-order', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'hm-featured', 'value' => 'true', 'compare' => 'LIKE' ) ) ); query_posts($args); ?>
to display posts in the order set out in the custom field on the homepage of a site I’m developing but it doesn’t seem to be working!
I have a number i.e. 1, 2, 3 etc in the “hm-slider-order” custom field and have a custom fieled called “hm-featured” so that when the post is marked as “true” and the number is in the field then it will display on the homepage. Currently it doesn’t.
Any help or ideas would be greatly appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Sort posts by custom field with number’ is closed to new replies.