php - Ordering ACF Wordpress -
i having trouble ordering output using advanced custom fields in wordpress. working nicely before had make alterations.
so need list order number of signups (meta field) , before, have added field no longer orders them in particular order.
$posts = get_posts(array( 'post_type' => 'schools', 'posts_per_page' => -1, 'meta_key' => 'signups', 'orderby' => 'meta_value_num', 'meta_key' => 'region', 'meta_value' => 'sw1', 'order' => 'desc' ));
i have tried lookup why coming stuck it. leaderboard highest number @ top naturally , ascends down.
i figured out now:
$posts = get_posts(array( 'post_type' => 'schools', 'posts_per_page' => -1, 'meta_key' => 'signups', 'orderby' => 'meta_value_num', 'order' => 'desc' , 'meta_query' => array( 'relation' => 'and', array( 'key' => 'signups', ), array( 'key' => 'region', 'value' => 'ea1', ), ) ));
Comments
Post a Comment