Can’t display ACF field, problem in previous section
Question
This is really weird issue, I can’t display second element from LATEST Section.
If I delete previous FEATURED section, this will be displayed. Really weird issue. I tried everything, but can’t find solution.
<section class="container mx-auto pb-12 px-2 sm:pb-16 md:pb-20 pt-10">
<!-- FEATURED -->
<h2 class="text-blue-primary text-xl mt-0 text-4xl font-bold tracking-wide p-3" id="intro-page-insights"><?php the_field('first_insight_title');?></h2>
<div class="flex flex-wrap mt-2 intro-latest-post page-insights-posts">
<?php
$featuredPosts = new WP_Query(array(
'posts_per_page' => 4,
'post_type' => 'featured_posts_home'
));
if($featuredPosts->have_posts() ) {
while($featuredPosts->have_posts()) {
$featuredPosts->the_post(); ?>
<a class="insight-item w-1/2 lg:w-1/4 p-2 md:p-3 mb-1 md:mb-0" href="<?php echo the_field('featured_posts_url') ?>">
<div class="intro-latest-post-item shadow-lg min-h-full">
<div class="image">
<img src="<?php the_field('featured_post_image'); ?>"/>
<img class="blog-post-eye-icon" src="<?php echo get_bloginfo( 'template_directory' ); ?>/media/eye.svg" />
</div>
<h3 class="px-3 py-2 sm:px-5 sm:py-6 text-lg md:text-xl text-blue-primary font-bold leading-tight"><?php the_title(); ?></h3>
</div>
</a>
<?php }
}?>
</div>
<!-- LATEST -->
<h2 class="text-blue-primary text-xl mt-0 text-4xl font-bold tracking-wide p-3" id="intro-page-insights"><?php the_field('second_insight_title');?></h2>
<div class="flex flex-wrap mt-2 intro-latest-post page-insights-posts">
<?php
$latestPosts = new WP_Query(array(
'posts_per_page' => 4,
'post_type' => 'latest_posts_home'
));
if($latestPosts->have_posts() ) {
while($latestPosts->have_posts()) {
$latestPosts->the_post(); ?>
<a class="insight-item w-1/2 lg:w-1/4 p-2 md:p-3 mb-1 md:mb-0" href="<?php echo the_field('latest_posts_url') ?>">
<div class="intro-latest-post-item shadow-lg min-h-full">
<div class="image">
<img src="<?php the_field('latest_post_image'); ?>"/>
<img class="blog-post-eye-icon" src="<?php echo get_bloginfo( 'template_directory' ); ?>/media/eye.svg" />
</div>
<h3 class="px-3 py-2 sm:px-5 sm:py-6 text-lg md:text-xl text-blue-primary font-bold leading-tight"><?php the_title(); ?></h3>
</div>
</a>
<?php }
}?>
</div>
</section>
0
2 months
0 Answers
7 views
0
Leave an answer
You must login or register to add a new answer .