php - Issue with ACF fields showing up in WordPress template -


okay, having bizarre issue ever. have custom home page template wordpress site working on.

you can see screenshot of how have acf fields template setup on backend here.

the issue having when try display field

<img src="<?php the_field('slide_1_thumb'); ?>" alt="" /> 

the image doesn't show @ all. have return value set 'image url', , odd thing shows images for

<?php the_field('slide_1'); ?> 

just fine no issues @ all.

i'm not sure doing wrong here, there no spelling errors @ all, reason slide_1_thumb images won't show up. want think 1 of occam's razor type of situations missed simple, i've gone on million times no luck.

below find copy of php code home-page.php template.

<?php /**  * template name: home page  *  * custom template home page.  *  * "template name:" bit above allows selectable  * dropdown menu on edit page screen.  */   get_header(); ?>   <div id="slideshow-container"> <div id="slideshow" class="slideshow pcfcu-theme">     <div class="slideshow-img" style="background-image: url(<?php      the_field('slide_1'); ?>);">         <div class="slideshow-img-inner">             <div class="slideshow-img-text">                 <h1><?php the_field('slide_1_title'); ?></h1>                 <p><?php the_field('slide_1_description'); ?></p>             </div>         </div>     </div>     <div class="slideshow-img" style="background-image: url(<?php the_field('slide_2'); ?>);">         <div class="slideshow-img-inner">             <div class="slideshow-img-text">                 <h1><?php the_field('slide_2_title'); ?></h1>                 <p><?php the_field('slide_2_description'); ?></p>             </div>         </div>     </div>     <div class="slideshow-img" style="background-image: url(<?php the_field('slide_3'); ?>);">         <div class="slideshow-img-inner">             <div class="slideshow-img-text">                 <h1><?php the_field('slide_3_title'); ?></h1>                 <p><?php the_field('slide_3_description'); ?></p>             </div>         </div>     </div> </div>  </div>   <div id="content-container"> <div id="content-container-inner">     <div id="recent-blog-entries-container">         <div id="recent-blog-entries">             <header><h1>recent blog entries</h1></header>             <?php $postslist = get_posts('numberposts=2&order=desc&orderby=date');                  foreach ($postslist $post) : setup_postdata($post);             ?>                  <h2 class="rbe-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>                 <p class="rbe-posted-on">posted on: <?php the_time(get_option('date_format')) ?></p>                 <div class="rbe-excerpt"><?php the_excerpt(); ?></div>             <?php endforeach; ?>         </div>     </div>      <div id="features">         <header><h1>features</h1></header>         <a class="goto1"><div class="feature-thumb"><img src="<?php the_field('slide_1_thumb'); ?>" alt="" /></div></a>         <a class="goto2"><div class="feature-thumb"><img src="<?php the_field('slide_2_thumb'); ?>" alt="" /></div></a>         <a class="goto3"><div class="feature-thumb"><img src="<?php the_field('slide_3_thumb'); ?>" alt="" /></div></a>     </div> </div>  </div>  <?php get_footer(); ?> 

another strange thing if take 1 of working acf images such as

<?php the_field('slide_1'); ?> 

it works , outputs image, when move down 'features' section of code see if work in place of 1 of small feature thumbnails, won't work in portion of code. it's if bottom 'features' portion of page has sort of error, don't see errors @ in code.

in other words, of code works perfect until last portion of 'feature' thumbnail images. can see live on website here.

when making new loop using get_posts(), should end wp_reset_postdata() function reset loop's data before get_posts(). try this:

<div id="recent-blog-entries">     <header><h1>recent blog entries</h1></header>     <?php $postslist = get_posts('numberposts=2&order=desc&orderby=date');      foreach ($postslist $post) : setup_postdata($post); ?>          <h2 class="rbe-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>         <p class="rbe-posted-on">posted on: <?php the_time(get_option('date_format')) ?></p>         <div class="rbe-excerpt"><?php the_excerpt(); ?></div>     <?php endforeach; ?>     <?php wp_reset_postdata(); ?> </div> 

adding wp_reset_postdata() after loop should fix you.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -