Hi Mark,
You can use the function query_posts()
or create a new instance WP_Query in the archive template file of the theme with the arguments orderby
and meta_key
to sort the post in the archive page by the field number value.
query_posts(
array(
'order' => 'DESC',
'meta_key' => 'field_id',
'orderby' => 'meta_value_num', //or 'meta_value_num'
)
);
$args = array(
'post_type' => 'post',
'orderby' => 'meta_value_num',
'meta_key' => 'field_id',
);
$query = new WP_Query( $args );
and display the field value of each post by using the helper function rwmb_meta
in the template parts file.
For more information, please follow the documentation.
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
https://developer.wordpress.org/reference/functions/query_posts/
https://wordpress.stackexchange.com/questions/15477/custom-query-with-orderby-meta-value-of-custom-field