WordPress.org

Ready to get started?Download WordPress

Forums

ACF outputs html but not fields (1 post)

  1. phdeoliveira
    Member
    Posted 1 year ago #

    I have acf setup to output a repeater field of things.

    Here's my code.

    <?php
    $rows = get_field('hero_slider');
    
    if($rows)
       {
          $content = '<ul class="ei-slider-large">';
          $slider = ' <!-- ei-slider-large -->
                           <ul class="ei-slider-thumbs">
    			    <li class="ei-slider-element">Current</li>';
    
           $count = 0;
            foreach($rows as $row)
    
    	{
    
    	$content .= '<li>
    		            <img src="' . the_sub_field('slider_image') . '" alt="' . the_sub_field('slider_image') . '">
    			     <div class="ei-title">
    			       <h2><span class="blue">' . the_sub_field('slider_title') . '</h2>
    			        <p>' . the_sub_field('slider_description') . '</p>
    				<a href="' . the_sub_field('slider_link') . '" class="emboss_button">Learn More</a>
    			       </div>
    			      </li>';
    
    	$slider .= '<li>
    		          <a href="#">Slide ' . ++$count . '</a>
    			 </li>';
    
    				}
    
    	$content .= '</ul>';
            echo $content;
    
            $slider .= '</ul>';
            echo $slider;
    			}
    ?>

    html outputs but the content inside of those fields dont.

    I have a stuck "loading" on the page.

    Any suggestions would be greatly appreciated! I'm assuming I have written something wrong that goes along with acf. - just can't for the life of me put a finger on it.

Topic Closed

This topic has been closed to new replies.

About this Topic