Step 5: Very basic example

The API gives you this JSON:

  • JSON-Feed:
    { "aaaa": 
       {
         "bbbb": "valbbbb",
         "cccc": "valcccc"
       }
    }
    
  • Shortcode Free Version (JCI-template engine):
    valbbbb and valcccc
    

    This is using the JCI-template engine

  • Shortcode PRO-Version (twig-template engine, remove debugmode=10 for hiding debug-information):
    [jsoncontentimporterpro url=https://json-content-importer.com/extra/json-examples/jci-step5.json debugmode=10 parser=twig]
    {{aaaa.bbbb}} and {{aaaa.cccc}}
    [/jsoncontentimporterpro]
    
  • 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=https://json-content-importer.com/extra/json-examples/jci-step5.json 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 “, ”, „, “