Support

Account

Home Forums Add-ons Repeater Field Custom Template in repeater field

Solved

Custom Template in repeater field

  • Hello Dear,

    I create Custom Template and Template in repeater field basic loop is used but this code is not working.
    How can i display all the repeaters in Custom Template?

    <?php /* Template Name: CustomPageTfilter */ ?>

    <?php
    if( have_rows(‘patine’) ):

    while ( have_rows(‘patine’) ) : the_row();

    the_sub_field(‘details_of’);

    endwhile;

    else :

    endif;
    ?>

  • Hi @nitin-godhani,

    Thanks a lot for reaching out to us.

    Looking at your code everything should work just fine. However, you will need to ensure that the global $post_id variable in use the correct one from your post/page.

    It is important that you make sure that your code is within the WP Loop, otherwise, you will need to provide a second parameter on the functions for the post id.

    Kindly check out the following samples that might be able to help you out.

    https://www.advancedcustomfields.com/resources/repeater/

    Let me know how it goes.

  • Hello Dear,

    Thanks For Replay,

    I am also find solution in custom template in how to use repeater
    like,

    <?php

    $custom_fields = get_post_custom(91);
    $patine = $custom_fields[‘patine’];
    foreach ( $patine as $key => $value1 ) {
    $key . ” => ” . $value1 . “<br />”;
    }
    ?>

    use this function and get array value.
    and array value are used in for loop and create shortcode.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Custom Template in repeater field’ is closed to new replies.