Hi there
I have a relationship field which links multiple custom post types and pages in a feature content section on my site home page. In my WP_Query I’m trying to figure out how to order the posts so that they conform to the display order set in the page editor?
$ids = get_field('feature_content', false, false);
if($ids){
$args = array(
'post_type' => 'any',
'posts_per_page' => 6,
'post__in' => $ids,
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC'
);
} else{
$args = array();
}
Ok, I figured this out. Needed to change orderby to ‘orderby’ => ‘post__in’
if($ids){
$args = array(
'post_type' => 'any',
'posts_per_page' => 6,
'post__in' => $ids,
'post_status' => 'publish',
'orderby' => 'post__in',
'order' => 'ASC'
);
} else{
$args = array();
}