> For the complete documentation index, see [llms.txt](https://wplake.gitbook.io/advanced-views/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wplake.gitbook.io/advanced-views/customization/filters-and-hooks/post-selection.md).

# Post Selection

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

Some filters are common and available in both the Lite and Pro versions, where some are only available in the Pro Edition, these have been labelled as "(Pro)".

Do you need to customize something but a filter isn't available? Then [Contact us](https://advanced-views.com/support/) and we'll try to add it as soon as possible.

## List

[advanced\_views/post\_selection/query\_args](#query-args) (Pro)

[advanced\_views/post\_selection/query\_args/id={id}](#query-args) (Pro)

[advanced\_views/post\_selection/posts\_data](#posts-data) (Pro)

[advanced\_views/post\_selection/posts\_data/selection\_id={id}](#posts-data) (Pro)

[advanced\_views/post\_selection/custom\_variables](#custom-post-selection-variables)

[advanced\_views/post\_selection/custom\_variables/selection\_id={id}](#custom-post-selection-variables)

[do\_shortcode\_tag](#shortcode-output)

## Description

### Query Args

Allows to customize WP\_Query arguments that are used to get posts for a *Post Selection*.

{% code overflow="wrap" %}

```php
add_filter('advanced_views/post_selection/query_args', function ($args, $cardId, $pageNumber) {
    // any modifications to the $args here
    return $args;
}, 10, 3);
```

{% endcode %}

* `$args` (array) Arguments for WP\_Query. See all available [here](https://developer.wordpress.org/reference/classes/wp_query/).
* `$card_id` (string) Unique ID of the current *Post Selection*
* `$page_number` (int) Current page number. By default 1, has another number only within the AJAX pagination.

### Posts Data

Allows to apply PHP filtering to the posts found.

{% code overflow="wrap" %}

```php
add_filter(
   'advanced_views/post_selection/posts_data',
   function (array $posts_data, string $card_dd, int $page_number, \WP_Query $query, array $query_args): array {
       // todo your modifications to the $postsData['postIds'] or $postsData['pagesAmount']
       return $postsData;
   },
   10,
   5
);
```

{% endcode %}

### Custom *Post Selection* Variables

Allows to add custom variables to the custom markup.&#x20;

{% code overflow="wrap" %}

```php
add_filter('advanced_views/post_selection/custom_variables', function ($customVariables, $cardId) {
    // any modifications to the $customVariables here
    return $customVariables;
}, 10, 2);
```

{% endcode %}

* `$custom_variables` (array) An associative array of values, where keys are variable names. These variables can be accessed in the custom markup with brackets, like `{VARIABLE_NAME}`
* `$card_id` (string) Unique ID of the current *Post Selection*

### Shortcode output

It’s a built-in WordPress hook that allows modifying the output of the whole shortcode. Code example shown below. Read more [here](https://developer.wordpress.org/reference/hooks/do_shortcode_tag/).

{% code overflow="wrap" %}

```php
add_filter('do_shortcode_tag', function ($output, $tag, $attr) {
    if ('acf_cards' != $tag) {
        return $output;
    }

    // todo my custom changes for $output

    return $output;
}, 10, 3);
```

{% endcode %}
