Support

Account

Home Forums General Issues How to pull the Title, Caption, and Alt Text Description of the uploaded files t

Solved

How to pull the Title, Caption, and Alt Text Description of the uploaded files t

  • Hello everyone 🙂

    I wonder how to pull this information from these fields, I’m trying this:

    $attachment_id = get_field('MYFILDFILE');
    $url = wp_get_attachment_url( $attachment_id );
    $title = get_the_title( $attachment_id );
     
    if( get_field('MYFILDFILE') ):
        ?><a href="<?php echo $url; ?>" >Download File "<?php echo $title; ?>"</a><?php
    endif;

    But, nothing happens. 🙁

    Somebody help me?

  • Hi @odirlon

    When you say ‘nothing happens’, have you tried any debugging to find out why?

    Does your get_field retrieve any data?

    As for the image data, just set the return type to ‘Image Object’. Then, the returned data will be an array of data containing title, alt, description, url, sizes, etc

  • First, thank you for your attention.
    And peopl apologize in advance, I’m Brazilian and do not understand English very well.

    I tried but did not recover the data, let me explain what I’m trying to do:
    I’m creating a post that will pdf files, is for public tenders, so when you open the contest will be published a file (so it is perfect plugin, then I want to buy the addons repeating fields) because even after this post will be entered another file showing the contestants, and so on …

    When I send the pdf file, I click to edit and appears fields such as name, description, caption … onths and want to use fields for file naming and description of it, talves change the name of a place for the date it was posted. I just need to know how to retrieve that data there.

    Attached is an example for you to understand better.

    grateful

  • Hi @odirlon

    Please read the documentation for the image and file fields. There are clear examples on how to load this data

    http://www.advancedcustomfields.com/resources/field-types/image/
    http://www.advancedcustomfields.com/resources/field-types/file/

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

The topic ‘How to pull the Title, Caption, and Alt Text Description of the uploaded files t’ is closed to new replies.