Support

Account

Home Forums Add-ons Repeater Field My code doesn't work Reply To: My code doesn't work

  • I just took a quick look at the theme, since for a change I could actually look at a themes code. The answer is, no, the theme does not use standard WP functions to include template files. What this means is that the standard global variables (like $post) are not available.

    I think you can correct this by simply declaring the global variables that you need to access, in this case $post

    
    <?php if(have_rows('otros_archivos')):
    	global $post; // add this
    	while (have_rows('otros_archivos')) : the_row();
    	$post_object = get_sub_field('antecedente');
    		echo "<ol>";
    		if($post_object): 
    			$post = $post_object; setup_postdata($post); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php wp_reset_postdata();
    		else:
    			echo "<li>No se ha incluido ningún antecedente aún.</li><br/>";
    		endif;
    	echo "</ol>";
    	endwhile;
    endif; ?>