<?php
$news_posts = get_field('news');
var_dump($news_posts);
$args = array(
'post in' => $news_posts,
'numberposts' => 5,
'post_type' => 'post',
'orderby' => 'post__in'
);
$query = new WP_Query( $args );
?>
<?php
foreach( $news_posts as $post ){
if($news_posts[0]){
setup_postdata($post);
get_template_part( 'template-parts/news-item', get_post_format() );
} else {
setup_postdata($post);
get_template_part( 'template-parts/news-item', get_post_format() );
}
}
wp_reset_postdata();
?>
<?php
$news_posts = get_field('news');
var_dump($news_posts);
$args = array(
'post in' => $news_posts,
'numberposts' => 5,
'post_type' => 'post',
'orderby' => 'post__in'
);
$query = new WP_Query( $args );
?>
<?php
$i=0;
foreach( $news_posts as $post ){
if($i++ == 0 ){
setup_postdata($post);
get_template_part( 'template-parts/news-item', get_post_format() );
} else {
setup_postdata($post);
get_template_part( 'template-parts/news-item', get_post_format() );
}
}
wp_reset_postdata();
?>