Home › Forums › Add-ons › Repeater Field › Repeater field in functions.php › Reply To: Repeater field in functions.php
Yes, i`ve declared this into a function in functions.php, this is my entire code:
function asset_empty_indexes(){
$post = get_post($_POST['post_id']);
<?php // My post ID displays ?>
<div class="hentry post" id="entry-<?php echo $post->ID; ?>">
<?php // My post title displays ?>
<?php echo apply_filters('the_title', $post->post_title) ?>
<?php // My post content displays ?>
<?php echo apply_filters('the_content', $post->post_content); ?>
<?php // My basic field displays ?>
<?php
$value = get_field( "prueba", $post->ID );
echo $value;
?>
<?php // But my repeater field does not displays ?>
<?php if( have_rows('attachment_field', $post->ID) ): ?>
<ul>
<?php while( have_rows('attachment_field', $post->ID) ): the_row();
$valueField = get_sub_field('attachment_name' );
?>
<li>
<p><?php echo $valueField; ?> </p>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</div>
}
I´m, using it this way because i call this function with ajax to insert it in a wordpress post, all my fields show except repeater field.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.