PRO: API, Access to JSON (sending Token) and generate CPT

Get data from via it’s API


[[jsoncontentimporterpro url= method=curlget method=curlget curloptions='CURLOPT_HTTPHEADER=Accept:application/json##Authorization:Token token=YOUR_API_KEY##Content-type:application/json' parser=twig332adj]
issues: {{issues|length}}
{% for i in issues %}
{{i.published_at}}: </code></code><a href="{{i.url}}" target="_blank" rel="noopener">title: {{i.title}}</a><code>
{% endfor %}
[/jsoncontentimporterpro]] gives you a list of “issues”. You can generate for each issue a “WordPress-page” (aka “Custom Post Type” or “Custom Post Page”) -for that you need:

  • A JCI-template:
    There are all information on how to connect the API and what data is displayed at the generated pages.
    Name: pattern-template
    URL: method=curlget method=curlget
Accept:application/json##Authorization:Token token=YOUR_API_KEY##Content-type:application/json


summary: {{summary}}
number: {{number}}
title: {{title}}
url: {{url}}
published_at{{published_at | date("d.m.y, H:i")}}
  • A new “Custom Page Type” (CPT):
    At the JCI-Options, Tab “Custom Post Types” there is “JCI-own way: Create JCI-Custom Post Types”. With this you can create a new CPT. You’re free to do this with many other Plugiins.
    Add the following at “JCI-own way: Create JCI-Custom Post Types”, save it an reload the page. Then there should be a new menu-entry “curatedname” (change ptname if you like).
    Importaint: The “Permalink Settings” of the WordPress must be at “Post name” reloaded to register this new CPT. Check that at the general WordPress “Settings” > “Permalinks”
  • A WordPress-Page called “generating-page”: This page is in the generating-page with a special JCI-Shortcode. Every time it is called, existing pages are deleted and new pages are created.
    • “loop” is the JSON-path to the list of issues in the JSON: Other JSON, other value here!
[[jsoncontentimporterpro nameoftemplate=pattern-template mode=create createoptions='{"type":"curatedtype", "loop":"issues", "title":"Issue-number: {{number}}", "slugname": "slugname{{number}}", "deleteold":"yes"}']]

Preview the “generating-page”:
There should be “start looping” where the issues are used for generating pages.
The generated pages do have URLs like “…/curatedredirect/slug179/”: “curatedredirect” is the value of “ptredirect” (change as you like), “slug{{number}}” comes from the “createoptions”-JSON in the Shortcode of the generating-page. Same is with the title of the page: “Issue-number: {{number}}”

If the Clikc on a generated Page gives a “page not found”-error: The “Permalink Settings” of the WordPress must be at “Post name”. Check that at the general WordPress “Settings” > “Permalinks”