Home Forums ACF PRO Display json along with acf.


Display json along with acf.

  • Hello everyone, I have an api that is from an external url. What would be the best way to pull the data from this api to through the ID, fill in automatically at the time of registering in the post.


      “birthday”: “1965-04-04”,
      “deathday”: null,
      “id”: 3223,
      “name”: “Robert Downey Jr.”,
      “also_known_as”: [
        “Bob Downey”,
        “小 勞勃 · 道 尼”,
        “روبرت داوني جونير”,
        “ロ バ ー ト ト · · ·”
        “Роберт Дауни-младший”,
        “Роберт Дауни мл.”,
        “Роберт Дауни младший”,
        “อ เบิ ์ ์ ์ ์”
      “gender”: 2,
      “Biography”: “Robert John Downey, Jr. (born April 4, 1965) is an American actor, Downey made his screen debut in 1970, at the age of five, when he appeared in his father’s film Pound, and has worked consistently During the 1980s I have had roles in a series of coming-of-age films associated with the Brat Pack.Three Than Zero (1987) is particularly notable, not only because it was the first time Downey’s acting would be acknowledged After Zero, Downey started landing roles in bigger films such as Air America (1990), Soapdish (1991) and Natural Born Killers (1994). Charlie Chaplin in the 1992 film Chaplin, for which he received an Academy Award nomination for Best Actor. “,
      “popularity”: 36.348214,
      “place_of_birth”: “Manhattan, New York, USA”,
      “profile_path”: “/1YjdSym1jTG7xjHSI0yGGWEsw5i.jpg”,
      “adult”: false,
      “imdb_id”: “nm0000375”,
      homepage: null

    In the example above through the ID field, typing only the id would it be possible to fill in all the information of the created fields? If possible could someone point the correct way to this? Remembering that json would be through an external url of an api.

  • This plugin is very good. I could not do this just using Acf pro?
    For example: Creating the fields and using `$json = file_get_contents($url);
    $data = json_decode($json, TRUE);` .
    To pull the fields in a dynamic way?

  • I’m sure it’s possible, but it’s not something that I’ve done or seen asked here. You’re looking to do an import. Imports are not extremely easy and importing to ACF makes it more complicated. On top of this you want to enter a value in one field and then have all the others dynamically populated, this means that you need to add AJAX on top of the import in order to get the values for the other fields and show them. It would simply be much easier to use the import plugin with the ACF add on in the Pro version and import them all at once. Since there is a URL you can even set it up to do the import once a day or as frequently as you expect the output of the url to change. I do a lot of coding, but I would need a really good reason to do this on my own rather than using an available tool I know can do the job, and probably much better than I can.

  • My question is: How could I manipulate the information. Ex:
    If the biography does not exist, how could I type it manually? I wanted to save this data received within acf. I can display all the information perfectly. However, I can not manipulate and edit the data I received. Can you point the way?

    //field is ID
    $url = ''.get_field('api').'?api_key=f16d933a3e68465c1ef9a4a82b41a2d5&language=pt-BR';
    $contents = file_get_contents($url);
    $personname = $person->name; 
    $biography = $person->biography;
    echo $personname . "<br>";
    echo "<img src='" . $profile_path ."'/ >";
    echo $biography = the_field('biography');
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Display json along with acf.’ is closed to new replies.