Hi,
Which API are you using and what does your endpoint settings look like?
I followed exactly as the tutorial did. Only the echo part of the data does not appear. When raw json and var dump, data shows..
FYI, If I just write echo $data[‘author’]; like your tutorial did and it shows a warning:
Warning: Undefined array key “author” in /var/www/html/wp-content/plugins/code-snippets/php/front-end/class-frontend.php(239) : eval()’d code on line 10
So I changed to echo $data[‘author’] ?? null; and the warning disappeared but no data were shown. I really appreciate it if you can help me. Thank you…
-
This reply was modified 3 years ago by
hereismine.
You will need to modify the PHP code to suit your own API and the data that it returns.
Using $data[‘author’] will likely not work as there is probably no key within your data that is named ‘author’.
If you paste the results of your var dump here, I can assist further.
Sorry I just gave a response now, I’ve resolved that. Turns out it should be like this $data[0][‘author’]; and the results appear. Thank you for your response!