Smart Twig templates
1. Functions by Advanced Views
{{ print_r(my_array) }}
{# calls the built-in PHP print_r function (displays the array for debug purposes) #}
{{ wp_interactivity_state('name', {stateArg:'some'}) }}
{# calls the built-in WordPress wp_interactivity_state function #}
{{ wp_interactivity_data_wp_context({contextArg:'some'}) }}
{# calls the built-in WordPress wp_interactivity_data_wp_context function #}
{{ paginate_links({total:'10',}) }}
{# calls the built-in WordPress paginate_links function #}{{ _query_argument('my-category-id') }}
{# retrieves the argument from the current page URL ($_GET in PHP) #}
{{ _is_user_with_role("role") }}
{# checks if user has the specified role.
You can pass user id as the second argument, or it'll use the current user id #}
{{ _is_user_logged_in() }}
{# calls is_user_logged_in() from WP #}
{{ _site_url("/my-page") }}
{# calls site_url() from WP #}
{{ _home_url() }}
{# calls home_url() from WP #}
{{ __("Some label") }}
{# translates the label.
You can pass the text domain as the second argument,
or it'll use the "Text Domain" of your theme
(declared in the headings of the style.css file of your theme) #}2. Filters by Advanced Views
3. Customization
3. Twig version
Last updated