PRO: Use Custom Post Fields
A WordPress-Page can have some Custom Post Fields (CPF). By that, one WP page can be almost identical to another; the only difference would be a CPF.
E.g., a CPF “language” on one page with “en” and on another “de”.
Having a JCI-Shortcode on such a page, the value of the CPF can be used in the API-URL and the twig-template.
With Twig, this works this way: Get the current pageID by wp_get_page_properties
and then get the CPF by wp_get_custom_field_value
:
{% set pageprop = wp_get_page_properties(debug, pageid) %} {% set pageid = jcipageparam.post.ID %} pageid: {{pageid}}<br> {% set valkeyaa = wp_get_custom_field_value(pageid, 'keyaa') %} CPF-keyaa: {{valkeyaa | json_encode }}<br> <hr> {% set valueOfCPF = valkeyaa.0 %} valueOfCPF: {{valueOfCPF}}<br> {% if valueOfCPF matches "/test/" %} yes, "test" is part of the CPF-Value {% else %} no, "test" is NOT part of the CPF-Value {% endif %}
more on that an example: http://api.json-content-importer.com/build-api-url-with-use-custom-fields/