Selection embedding shortcode
In Advanced Views, Post Selection embedding happens using native WordPress shortcodes. Each Post Selection has its own unique shortcode that can be pasted into any location, regardless of the theme, editor, or page builder you're using.
Shortcodes also support arguments, allowing you to customize the behavior of the same entity in different contexts.
1. Shortcode format
Each Post Selection shortcode should contain at least 2 arguments:
[avf-post-selection name="Name" id="651d5d75bfdf2"]nameargument - used for clarification purposes only and doesn't play any functional role.idargument - associates the shortcode with a specific Layout.
2. Optional arguments
The following shortcode arguments can be added to any Post Selection shortcode:
2.1) class - adding HTML class
This argument allows you to add a class to your Post Selection main wrapper dynamically.
In most cases, you should add all the classes directly to your Post Selection, but in some cases you will need to assign this class dynamically.
[avf-post-selection name="Name of Selection" id="651d5d75bfdf2" class="YOUR_CLASS_HERE"]2.2) user-with-role - restricting visibility by role
Both "user-with-roles" and "user-without-roles" arguments allow you to restrict access to the specific Post Selection.
2.3) custom-arguments - transiting fields
Using this argument, you can pass any custom arguments to the Post Selection Controller:
Custom arguments are available only inside the Layout Controller. They're not available directly in the Layout template. If you need to use them inside the template, you can transit them in the snippet.
3. Displaying inside theme templates
To embed Post Selection into theme templates, you can either render the text shortcode using a native WordPress do_shortcode function, or employ the Advanced Views API:
Last updated