Step 6: Shortcode parameter

Step 5 showed you the basic usage of the Shortcode: There the parameter “url” is used. Besides “url” you can use some more parameter:

Shortcode-Parametervalue of parameter
url=http://…json (use http://username:password@www…. for basic authentification)
numberofdisplayeditems=number: how many items of level 1 should be displayed? display all: leave empty or set -1
urlgettimeout=number: who many seconds for loading url till timeout?
cachetime=Before Version 3.3.5 all Cache-Settings were in the Plugin-Options and valid for all URLs. Now you can add "cachetime=n" to set the cachetime for this Shortcode to n seconds – regardless of the settings in the plugin-option, even when caching is switched of there.
feedsource=PRO-Feature (from 3.1 on): by using feedsource=file you can load JSON-feeds from the server-filesystem
feedfilename=directories and name of JSON-feed from the server-filesystem (encanced by basepath, see Plugin-Options: "Settings" > "Load JSON-data from server filesystem"

PRO-Feature (from 2.0.9. on) Dynamic JSON-feed URLThe Shortcode-Parameter "url" is static by default. If switched on in the Plugin-options with the following 3 Shortcode-Parameter you can change the URL of the JSON-Feed via GET-Parameter.
urlparam=List separated by # of allowed GET-variablename usedin the JSON-Feed-URL. E.g. "var1#var2". Special: aaa%5Bbbb%5D / [aaa]=bbb
pathparam=List separated by # of allowed GET-variablenames for the path of the JSON-Feed-URL. E.g. "path1#path2#pagename"
fileext=Static (not changeable via GET) extension of the JSON-Feed-URL. E.g. if "php" ".php" is added to the URL. If fileext starts with an "?", then no "." is added. This is useful when passing apikeys like "?apikey=007"
Example-URLLets say url="http://jsonserver…". With the upper examples, this gives us the complete JSON-feedurl in this way: "http://jsonserver…/GET_VALUE_path1/GET_VALUE_path2/GET_VALUE_pagename.php?var1=GET_VALUE_var1&var2=GET_VALUE_var2" where "GET_VALUE_item" the GET-value of "item=…" is when calling the wordpress-page in the browser like "http://wordpressserver…/page?path1=one&path2=two&pagename=mypage&var1=10&var2=40"
customfieldparam= NAMES_OF_CUSTOMFIELDSDefine some comma-separated variables in the Shortcode-Parameter “customfieldparam” like “customfieldparam=param1,param2”. In the JSON-feed-URL you can then use this Parameter in this way: “http://wherever/path//page.json?par=”. Then set the WordPress-Customfields param1 and param2 on the page you use this shortcode. When building the page, and will be replaced by the customfield-values.
urlgetaddrandom=yesIf set to "yes" the plugin adds a random-parameter to the GET-URL to bust a API-cache. Ignored if not set to "yes".

PRO-Feature Shortcode-Parameter: select template-engineeither "JCI" or "twig"
parser=twigif set the twig-template engine is used. otherwise the JCI-template engine is used by default
trytohealjson=yesSome APIs / URLs deliver invalid JSON (invalid in the sense PHP-libraries can't handle it). This is due to invalid Characters before or after the first square or curled brackets. When setting "trytohealjson=yes" those Characters are emoved from the JSON before used in the Plugin.
debugmode=NUMBERPrior to version 3.3.6 there was either debug=on or off for the whole page. By "debugmode=NUMBER" you can set the debugmode for each shortcode: NUMBER=2 shows some debug infos, NUMBER=10 all available debug infos.

PRO-Feature (from 3.0.2 on) Shortcode-Parameterselect http-method: "GET" / "POST" / "CURL"
default,no method definedGET-method with wordpress-GET-Function
method="post"The JSON-feeds are retrieved by wordpress-http-GET by default. If you want to switch to wordpress-POST use method="post" as shortcode-parameter.
method="rawget"If you want to switch to PHP-GET use method="rawget" as shortcode-parameter.
method="rawpost"If you want to switch to PHP-GET use method="rawpost" as shortcode-parameter.
method="curlget"If you want to switch to CURL-GET use method="curlget" as shortcode-parameter. See also Plugin-Options "curl-settings" for CURL-Authenatication-Settings (e.g. do digest authentication via curlget).
postpayload="JSON_PAYLOAD"Add data to header: Some POST-APIs need inputdata like that. If "JSON_PAYLOAD" contains strings like "POSTGET_something" where something is a letter or number this is replaced by the value of the "something" GET / POST parameter. If "JSON_PAYLOAD" must contain ] or [ use #BRO# ("bracket-open") and #BRC# ("bracket-close") instead, otherwise wordpress gets confused.
urlencodepostpayload=noAdd this, if the postpayload should not be urlencoded. It depends on what the API requires.
postbody="JSON_BODYLOAD"Add data to the http-body: Some POST-APIs need inputdata like that. If "JSON_BODYLOAD" must contain ] or [ use #BRO# ("bracket-open") and #BRC# ("bracket-close") instead, otherwise wordpress gets confused.

PRO-Feature Shortcode-Parameter for http-header and Authentication
header="key_a:val_a##b:key_b##…"pass http-header to API, see "List of HTTP header fields"
auth="key_a:val_a##b:key_b##…"usage like "header=…" above, but attached to "headers"-field in http-header.

PRO-Feature Shortcode-Parameter template manager call template from shortcode
id=unique id / number of the template given in the template-manager
nameoftemplate=unique name of the template given in the template-manager

JCI-template engine onlyignored when twig-template engine
basenode=starting point of datasets, the base-node in the JSON-Feed where the data is
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)"
oneofthesewordsmustbeindepth=default: 1, number:where in the JSON-tree oneofthesewordsmustbein must be?
oneofthesewordsmustnotbein=default empty, if not empty keywords separated by ','. If at least one of the keywords is in the created text, this text is not displayed"
oneofthesewordsmustnotbeindepth=default: 1, number:where in the JSON-tree oneofthesewordsmustnotbein must be?

PRO-Feature Shortcode-Parameter used only for JCI-template engineignored when twig-template engine is selected
Display only some JSON-dataremove and filter. Yet only possible in the top level of the JSON-tree
requiredfieldsandvalues=default empty, list of #" separated filednamesm where the required value is added by "=". E.g. "code=EUR,CAD#rate=18" means, the either the datafield "rate" has to be 18 OR the datafield "code" has to be EUR or CAD.
requiredfieldsandvaluesdepth=default: 1, number:where in the JSON-tree requiredfieldsandvaluesdepth must be?
requiredfieldsandvalueslogicandbetweentwofieldsdefault empty, if yes" the logic between two "#" separated datafields is AND (and not OR!). In the above example then both "rate" and "code" must match. Whereas the "," separated values are always OR connected!
dodisplayonlyif=default empty, define a POST/GET-parameter, that must be in the input. Otherwise nothing is displayed. E.g. POST:varname1:varnamevalue1" means, that in the calling wordpress-site "variablename=variablevalue" must be sent either by POST (GET also possible). Allowed chars for varname1 nd varnamevalue1: [0-9a-zA-Z_-.;] This is for checking if such a call comes from a special form.
filterfieldremove=default empty, "," separated list of filters. If there is an "=" in the filter, the "filter=filtervalue" is handled as such: The value if the datafield "filter" must regexp-match "filtervalue". If there is no "=", then a POST- or GET-input is required: The value of the Post/GET-input is then the value. regexp means, that the parts defined by an regular-expression must match of the "filtervalue". E.g. "test123" can be matched by something like"^([a-z]+)\d{3}$". See http://php.net/manual… for more. If there is no match, this datafield and his whole underlying tree is removed from the JSON and is not displayed.
filterfieldrequired=default empty, almost the same as "filterfieldremove", but the "," separteded filed/values are connected by OR. So if one of it matches, this JSON-data is not displayed.
Sorting the data from the JSON-feedyet only possible in the top level of the JSON-tree
sortfield=default empty, Sort JSON-feed by the here defined datafield.
sortorderisup=default empty and then set to FALSE. If set to "yes" the sorting order is reversed.
sorttypeisnatural=default FALSE and set to non-natural sorting. If set to "yes" the JSON-feed is sorted "natural". See here for details about "natural sorting".