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've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.
— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.
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.