Print

Free: Shortcode-options

The basic structure of a WordPress-Shortcode is explained here.

The free JSON Content Importer has several of those Shortcode-parameternames. Some for Data-Access, some for Data-Usage.

Data-Access shortcode-parameternames

  • The only Mandatory field:
    url=https://…json
    Define where to find the JSON. Maybe some Plugin-Settings for authenatication are needed to set.
    Some APIs require basic authentification when calling. In the browser a login-window pops up and after inserting the correct username and passwort access is granted.
    In such cases try “http://username:password@www….”.
    See http://www.ietf.org/rfc/rfc1738.txt chapter “Common Internet Scheme Syntax”:
    //<user>:<password>@<host>:<port>/<url-path>
  • urlgettimeout=NUMBER
    How many seconds for loading url till timeout?
    Default: 5 seconds
    Increase if you have a slow API
  • debugmode=10
    If set to 10 the Plugin shows basic debug information: Esp. you see what url is used and the anser of the url. See example here.
    Default: empty
  • fallback2cache=NUMBER
    If set this overwrites the general settings on how to “handle unavailable APIs”. Read here more about that.
    • Default (fallback2cache not set): do not try to use cached JSON
    • fallback2cache=1
      If the API-http-answercode is not 200: try to use cached JSON
    • fallback2cache=2
      If the API sends invalid JSON: try to use cached JSON
    • fallback2cache=3
      If the API sends invalid JSON or API-http-answercode is not 200: try to use cached JSON
      Recommended (not switched on due to backwards-compatibility)

Data-Usage shortcode-parameternames

  • basenode="jsonnode1.jsonnode2 etc"
    Define the node-path in the JSON-data to the group of JSON-datasets which should be looped (array or object).
    Default: empty, then the plugin starts looping at the “top” of the JSON-data
  • numberofdisplayeditems=NUMBER
    By “basenode” the plugin knkows where to begin in the JSON. Usually it now loops through the JSON and finds 1 or more datasets. “numberofdisplayeditems” tells the plugin how many items should be displayed?
    Default: show all (leave empty or set -1)
  • oneofthesewordsmustbein="default empty, if not empty keywords separated by ‘,’"
    At least one of these keywords must be in the created text (here: text=code without html-tags)
    Default: empty
    Example
  • oneofthesewordsmustbeindepth=NUMBER
    If using “oneofthesewordsmustbein” you must also use this parametername. This tells the plugin, where in the JSON-tree “oneofthereswordsmustbein” is.
    Default: 1
  • "oneofthesewordsmustnotbein" and "oneofthesewordsmustnotbeindepth"
    work in the same way as “oneofthesewordsmustbein“/ “oneofthesewordsmustbeindepth
  • removewrappingsquarebrackets=y
    Try this if JSON can’t be parsed by the free JCI-Pluign as the JSON comes with [ at the beginning and ] at the end. If set to “y” this removes [ and ] from the JSON received from the API. If then the JSON is still valid JSON the parsing might work.
  • nojsonvalue=y
    If set to “y” the JSON for the pluign is modified. Then in the plugin we have JSON like
    { “nojsonvalue” : “return from the API-URL as string” }
    Then you can output in the template {nojsonvalue}.
    This is great when the API-URL does not return JSON but just a string.
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Next Free: show the data {…}
On this page: