Support

Account

Home Forums General Issues Outputting info from a 'File' field? Reply To: Outputting info from a 'File' field?

  • Yes, it will work, but you should check the radio field first because it doesn’t make sense to get the values for the file unless you’re actually going to show them.

    
    <?php 
      if (get_field('product_brochure') == 'yes') {
        $file = get_field('product_brochure_pdf');
        if ($file) {
          ?>
            <a target="_blank" href="<?php 
              echo $file['url']; ?>" title="<?php 
              echo $file['title']; ?>"><?php 
              echo $file['title']; ?></a>
          <?php 
        } // end if file
    } // end if product_brochure