Support

Account

Home Forums Front-end Issues Field output not showing

Solving

Field output not showing

  • hi,
    First of all thank ACF for the amazing plugin. I am working on wordpress tube theme. I want to add a custom field named download,a url base field.
    It shows in the video post edit panel but not showing at frontend. Any help should be appreciated.
    My Feild group key
    group_5f80b59aec8b3
    Feild Name
    Download

  • Are you meaning for your end user to download a file? If you use URL as the field type, it will take you to the url. By using the File field type, you can select ‘File URL’ as the return value and then on the php page use:

    <?php
    $file = get_field('download');
    if( $file ): ?>
        <a href="<?php echo $file['url']; ?>"><?php echo $file['filename']; ?></a>
    <?php endif; ?>

    to grab the value on the front end. Then when the link is clicked, the download will be done automatically.

  • I want to add url because i stored my downloadable files on external file hosting site. and in which theme options include the code?

  • Okay so you should use the following:

    <?php 
    $download = get_field('download');
    if( $download ): ?>
        <a class="button" href="<?php echo esc_url( $download ); ?>">Download File</a>
    <?php endif; ?>

    This would go in the php template file with the other content for the page you wish to add it to.

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

You must be logged in to reply to this topic.

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.