Request via wordpress.org: “no feed coming through”
Question: “Can’t get raw data from this feed to show up at all. Not sure what I am missing: https://www.trustatrader.com/api/consumer-reviews?username=CWYAONE&format=json“
I saved this JSON to https://api.json-content-importer.com/extra/json/blog/trustatrader_com.json to have this example independent from external sites.
How to add this data to a WordPress page?
My way: Create a new page and add a “JSON Content Importer Free”-Block.
There use the above URL and switch on the debug mode.
Open https://jsoneditoronline.org in a new Browser-Tab and copypaste the JSON there: You’ll see that “consumer_reviews_api” is the wrapping name. Use this as basenode in the Block.
You also see a object “trader” with the item “reviews”.
With the Gutenberg-Block you can try templates and you see at once if it’s working or not:
The syntax of the free plugin-template is
{subloop:trader:-1} company_name: {company_name} {/subloop:trader}
Similar it is with the array “reviews”. Hence the syntax is
{subloop-array:reviews:-1} reviewer_name: {reviewer_name}<br> {/subloop-array:reviews}
So the whole shortcode is (if you don’T want to have a Gutenberg-Block):
[[jsoncontentimporter url=https://api.json-content-importer.com/extra/json/blog/trustatrader_com.json numberofdisplayeditems=-1 basenode=consumer_reviews_api urlgettimeout=5] {subloop:trader:-1} company_name: {company_name} {/subloop:trader}<br> {subloop-array:reviews:-1} reviewer_name: {reviewer_name}<br> {/subloop-array:reviews} [/jsoncontentimporter]]
In Action:
company_name: C Wyatt Gas Servicesreviewer_name: Nick Digman
reviewer_name: Rob Selby
reviewer_name: Chris Swinburn
reviewer_name: Sam Sophie
reviewer_name: S Ho