When you create a post in WordPress, there’s a field called "order".
How can i make it work to for example, i put 5
and the post goes to the 5th
position when displayed on the page?
I tried this but didn’t work:
<?php
$args = array(
'post_type' => 'team',
'posts_per_page' => 30,
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
?>
2
Answers
If "order" is a custom field, then you could do something like this:
Let me know if it works for you!
When the post is saved, WordPress takes the value from the "order" field and saves it to the wp_posts.menu_order column within the database. With that being said, you’ll want to set the "orderby" parameter to "menu_order".