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

WordPress hooks of Advanced Views

Advanced Views includes a set of WordPress hooks, allowing you to customize the plugin behavior from your theme (or code snippets).

This page focuses only on the generic plugin hooks; check Layout hooks and Post Selection hooks to see specific entity hooks.

1. Generic hooks list

Please make sure you've installed the latest version of the plugin before using these filters.

If you need to customize something, but a filter or hook is unavailable, then contact us, and we will try to add it as soon as possible.

advanced_views/manage_capability

advanced_views/container

advanced_views/twig/custom_functions

advanced_views/twig/custom_filters

2. Generic hook descriptions

Manage capability

By default, Layout and Post Selection management (menu items, lists, etc.) is available only to administrators (or custom roles with the manage_options capability). To change the default capability use this hook:

add_filter( 'advanced_views/manage_capability', function (string $manage_capability): string {
    // Allow management for anyone who can edit posts, e.g. authors.
    return "edit_posts";
} );

You can read more about roles and capabilities in the WordPress Docs.

Container

Using this hook, you can define a PHP-DI container, and then use it inside Layout PHP Controlller and Selection PHP Controller classes. Read more

Custom Twig functions

Note: every item of the array represents the custom function. First argument is the function name, second is the callback. Third argument is optional, here you can pass any function settings supported by Twig.

For the function callback, you can define as many arguments as you need.

Now you can call your functions in twig templates of your Layouts and Post Selections.

Custom Twig filters

Note: every item of the array represents the custom filter. First argument is the filter name, second is the callback. Third argument is optional, here you can pass any filter settings supported by Twig.

For the filter callback, you can define as many arguments as you need.

Now you can call your filters in twig templates of your Layouts and Post Selection.

Last updated