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 ?>
           $value = get_field( "prueba", $post->ID );
           echo $value;
        <?php // But my repeater field does not displays ?>
        <?php if( have_rows('attachment_field', $post->ID) ): ?>
            <?php while( have_rows('attachment_field', $post->ID) ): the_row();
               $valueField = get_sub_field('attachment_name' );
                <p><?php echo $valueField; ?> </p>
           <?php endwhile; ?>
        <?php endif; ?>

    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.