I have some task which try to solve may be not in smartest way, but so far I got only this idea. I have 5 custom post types. In each of this - one post. Want these posts loop and appear on my index.php .Also these posts has the_field() functions from ACF plugin. The result not what I expected. This is the code in index.php
<?php
$posttypes = array( 'plays','watch','news','shop','contact' );
$args = array(
'post_type' => $posttypes
, 'posts_per_page' => 5 );
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<div id="owl-demo" class="owl-carousel owl-theme">
<?php foreach($posttypes as $posttype){?>
<?php $the_query->the_post(); ?>
<div class="item">
<?php get_template_part( 'single', $posttype ); ?>
</div>
<?php };?>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</div>
Also I will post one of the post's code, like single_news.php
<?php get_header();
while ( have_posts() ) : the_post() ;?>
<div class="container-fluid "> <!-- play section -->
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-2 col-lg-2">
<h2 class="" style="text-transform:uppercase"><?php the_field('name');?></h2>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-2 col-md-2 col-lg-2">
<h2 class="" style="text-transform:uppercase"><?php the_field('news_name');?></h2>
</div>
</div>
</div> <!-- row -->
</div>
Actually the end of this file I couldnt post but it itself correct with closing dives and endwhile.