JSON Content Importer

Mô tả

Display live data from a JSON-feed / API on your wordpress-site!

Grab JSON from an URL and convert it to HTML on a WordPress-Page

JSON Content Importer – API- and Webservice-Connector – Powerful and Simple JSON-Import Plugin:

  • Use a templateengine to display the data from an JSON-Feed.
  • Define the url of the JSON-Feed, a template for it and other options like number of displayed items, cachetime etc..
  • Cacher with new Option: If a http-API request fails, you can use the maybe cached JSON. Set the radio-button in the plugins settings: what API-problem should be handled how (either a non valid API-http-response or a non JSON-API-response – or both). By default for backwards-compatibility this is switched off. Recommendation: Switch on the plugins-cacher (e. g. some minutes) and select the radiobutton for “If the API-http-answercode is not 200 OR sends invalid JSON: try to use cached JSON” in the plugins options.
  • The templateengine inserts the JSON-data in the template.
  • You can either use this as wordpress-shortcode inside a page – whereby some extras like urlencoding can be invoked.
  • Or use the Gutenberg Mode: Then you don’t have the hassle to put an shortcode together, test it and change it. With a Gutenberg-Block you can test it in realtime and create a shortcode (if you want to stay with shortcodes).

How to start and help

  • 2 Steps using this plugin, plus: examples and the PRO-Version.

How to example of using the plugin

Basic structure of the Shortcode:

  • url=”http://…json”
  • 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?”
  • basenode=”starting point of datasets, the base-node in the JSON-Feed where the data is”
  • oneofthesewordsmustbein=”default empty, if not empty keywords spearated 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?”
    This is the template:
    Any HTML-Code plus “basenode”-datafields wrapped in “{}”
    {subloop:”basenode_subloop”:”number of subloop-datasets to be displayed”}
    Any HTML-Code plus “basenode_subloop”-datafields wrapped in “{}”. If JSON-data is HTML add “html” flag like “{fieldname:html}”

  • templates like “{subloop-array:AAAA:10}{text}{subloop:AAAA.image:10}{id}{/subloop:AAAA.image}{/subloop-array:AAAA}” are possible:
    one is the recursive usage of “subloop-array” and “subloop”.
    the other is “{subloop:AAAA.image:10}” where “AAAA.image” is the path to an object. This is fine for some JSON-data.

Some special add-ons for datafields

  • “{street:purejsondata}”: Default-display of a datafield is NOT HTML, but HTML-Tags are converted : use this to use really the pure data from the JSON-Feed
  • “{street:html}”: Default-display of a datafield is NOT HTML: “<” etc. are converted to “&amp,lt;”. Add “html” to display the HTML-Code as Code.
  • “{street:htmlAndLinefeed2htmlLinefeed}”: Same as “{street:html}” plus “n”-Linefeeds are converted to HTML-Linebreak
  • “{street:ifNotEmptyAddRight:,}”: If datafield “street” is not empty, add “,” right of datafield-value. allowed chars are: “a-zA-Z0-9,;_-:<>/ “
  • “{street:html,ifNotEmptyAddRight:extratext}”: you can combine “html” and “ifNotEmptyAdd…” like this
  • “{street:ifNotEmptyAdd:,}”: same as “ifNotEmptyAddRight”
  • “{street:ifNotEmptyAddLeft:,}”: If datafield “street” is not empty, add “,” left of datafield-value. allowed chars are: “a-zA-Z0-9,;_-:<>/ “
  • “{locationname:urlencode}”: Insert the php-urlencoded value of the datafield “locationname”. Needed when building URLs

JSON Content Importer PRO

This free version of “JSON Content Importer” can put together many JSON-Feeds and is flexible with it’s template-engine. But sometimes you might need more:

  • application building by creating a searchform and connect it to a JSON-API in the background: pass GET-Variables to use a dynamic JSON-Feed-URL (“talk to API / webservice”)
  • much better and more flexible templateengine: twig
  • use it as Widget
  • create Custom Post Types
  • usage on multisite installations
  • store Templates independent of pages
  • more Shortcode-Parameters
  • executing Shortcodes inside a template and
  • more features…

If the free version comes to your limit, I’m looking forward that you COMPARE PRO and FREE of the JSON Content Importer.

Rate this post

Hãy bình luận đầu tiên

Để lại một phản hồi

Thư điện tử của bạn sẽ không được hiện thị công khai.