Support

Account

Home Forums Add-ons Repeater Field Repeater field FILE

Helping

Repeater field FILE

  • I need to setup the repeater field with the file/attachment field.

    I have setup the code not using the repeater field for just a single file/attachment, see below, but I need to implement this into the repeater field, so the user can upload multiple files/attachments.

    Does anyone know the input code using the file/attachment field and the repeter field. I want to diplay the file/attachment title.

    <?php
    $attachment_id = get_field(‘links’);
    $url = wp_get_attachment_url( $attachment_id );
    $title = get_the_title( $attachment_id );

    if( get_field(‘links’) ):
    ?>” ><?php echo $title; ?><?php
    endif;
    ?>

  • Hi Guys

    I have updated my code using the repeater field, see below

    However i can not get the actual file title to be a link and open the downloadable file.

    The url of the file diplays on the front but not as alink to the download

    Here is a link to my website: see the code at the bottom of the page

    http://www.whiteblackdigitaldev.com/invest2day/property/191-barkers-rd-kew/

    any help please

    <?php

    $attachment_id = get_field(‘downloads’);
    $url = wp_get_attachment_url( $attachment_id );
    $title = get_the_title( $attachment_id );

    // check if the repeater field has rows of data
    if( have_rows(‘downloads’) ):

    // loop through the rows of data
    while ( have_rows(‘downloads’) ) : the_row();
    ?>

    <!– display a sub field value –>

    <?php the_sub_field(‘download1’); ?>

    “”<?php echo $title; ?>”

    <?php endwhile; else :
    // no rows found
    endif;
    ?>

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

The topic ‘Repeater field FILE’ is closed to new replies.