Step 2 of 2: Convert JSON to HTML

If you’re successful with “Step 1 – Access to JSON” the plugin has some JSON to work with.
To display it on a wordpress-page/post we have to convert the JSON to HTML: For that we need a template with placeholders für the JSON-data.

See how that works:
The API gives you this JSON:

  • JSON-Feed:
    { "aaaa": 
         "bbbb": "valbbbb",
         "cccc": "valcccc"
  • Shortcode Free Version (JCI-template engine):
    [jsoncontentimporter url= basenode=aaaa]
    {bbbb} and {cccc}

    This is using the JCI-template engine

  • Shortcode PRO-Version (twig-template engine, remove debugmode=10 for hiding debug-information):
    [jsoncontentimporterpro url= debugmode=10 parser=twig]
    {{aaaa.bbbb}} and {{aaaa.cccc}}
  • Shortcode PRO-Version with the plugins template manager:
    Create a template in the plugins template-manager and remember the number of this template:

    {{aaaa.bbbb}} and {{aaaa.cccc}}

    Then put this shortcode on a page:

    [jsoncontentimporterpro url= parser=twig id=NUMBER_OF_TEMPLATE]

    This is using the twig-template engine

  • Result:
    valbbbb and valcccc
  • Common errors:
    avoid / remove any linefeeds in the [jsoncontentimporter(pro)…] statments. Linefeeds can cause the a shortcode-parameter is not available and the plugin has not the needed information.
    when using the template-manager use only [jsoncontentimporterpro url=… id=…] and do NOT add [/jsoncontentimporterpro]. If this is there the id=… is ignored.
    quotation marks are a common trouble-source: The best way is not to use quotation marks (works as long there is no blank space in the parameter. Also: When copypasting code sometimes the “wrong” quotation marks are inserted and wordpress gets confused. Ok are single (') and double (") quotation marks. Problematic are other like “, ”, „, “