For the complete documentation index, see llms.txt. This page is also available as Markdown.

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"]
  1. name argument - used for clarification purposes only and doesn't play any functional role.

  2. id argument - 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.

"Restrict" means that the shortcode won't be rendered, so if you'd like to show a restriction type message to users, then consider customizing the Layout template to check user roles there.

2.3) custom-arguments - transiting fields

Using this argument, you can pass any custom arguments to the Post Selection Controller:

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