Advanced Views Docs
Live PlaygroundDownload PluginGet PRO
  • πŸ’‘Help Centre
  • ⚑Getting Started
    • Introduction
      • Key Aspects
      • Creating Your First View
      • Creating Your First Card
      • Plugin Terms
      • Plugin Interface
        • Field Options
    • Installation
      • Advanced Views Lite
      • Advanced Views Pro
      • Comparison Table
      • Upgrading from Lite to Pro
    • Supported data vendors
    • Starter theme
  • 🌟Display Content
    • WordPress
      • Post
      • Taxonomy terms
      • User
      • Comments
      • Menus
    • WooCommerce Product
    • Meta fields
      • Basic fields
        • Number
      • Content fields
        • Image
        • File
        • WYSIWYG
        • oEmbed
        • Gallery
      • Choice fields
        • Select/checkbox/radio
        • True / False
      • Relationship fields
        • Link
        • Post_object
        • Page Link
        • Relationship
        • Taxonomy
        • User
      • Advanced fields
        • Google Map
        • Google Map Multiple Markers
        • ACF OpenStreetMap Field
        • Date/time picker
      • Layout fields
        • Group (Pro)
        • Repeater (Pro)
        • Flexible (Pro)
    • Object fields
    • Custom Data (Pro)
    • Custom Gutenberg Blocks (Pro)
    • Mount Points (Pro)
    • Front-end assets management (Pro)
  • πŸ¦Έβ€β™‚οΈQuery Content
    • Basic Filters
    • Meta Filters (Pro)
      • Current Post
      • Comparison
      • Dynamic Injection
    • Taxonomy Filters (Pro)
    • Pagination (Pro)
    • Custom Data (Pro)
  • πŸ†Shortcode Attributes
    • Common Arguments
    • View Shortcode
    • Card Shortcode
  • πŸ§™β€β™‚οΈTemplates
    • Customizing the Template
    • Template engines
      • Twig
      • Blade
    • CSS & JS
      • BEM Methodology
      • WordPress Interactivity API
    • File system storage
    • Pre-built components
    • Reusable components library (Pro)
    • Live reload
    • Multilingual
    • Custom Ajax & Rest API (Pro)
  • β˜•Guides
    • Display Custom Post Type (CPT) on another post
    • Display Employees (CPT) of a Company (CPT)
    • Display Nested Repeater Fields
    • Map Marker from ACF Image
    • Display all CPT items on a single map
  • πŸ› οΈTools
    • Export/Import
    • Demo Import
    • Settings
    • Preview
  • 🏹Troubleshooting
    • Compatibility
    • Report a bug
    • Payment Issues
    • Lite Support (Forum)
    • Pro Support
  • βš™οΈCustomization
    • Filters and Hooks
      • View
      • Card
    • Suggest a feature
    • Performance
Powered by GitBook
On this page
  • List
  • Description
  • Query Args (Pro)
  • Posts Data (Pro)
  • Custom Card Variables (Pro)
  • Shortcode output

Was this helpful?

  1. Customization
  2. Filters and Hooks

Card

Customize a query (WP_Query) that is used to get posts for a Card.

PreviousViewNextSuggest a feature

Last updated 1 month ago

Was this helpful?

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 Basic 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 and we'll try to add it as soon as possible.

List

(Pro)

(Pro)

(Pro)

(Pro)

(Pro)

(Pro)

Description

Query Args (Pro)

Allows to customize WP_Query arguments that are used to get posts for a Card.

add_filter('acf_views/card/query_args', function ($args, $cardId, $pageNumber) {
    // any modifications to the $args here
    return $args;
}, 10, 3);
  • $card_id (string) Unique ID of the current ACF Card

  • $page_number (int) Current page number. By default 1, has another number only within the AJAX pagination.

Posts Data (Pro)

Allows to apply PHP filtering to the posts found.

add_filter(
   'acf_views/card/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
);

Custom Card Variables (Pro)

Allows to add custom variables to the custom markup.

add_filter('acf_views/card/custom_variables', function ($customVariables, $cardId) {
    // any modifications to the $customVariables here
    return $customVariables;
}, 10, 2);
  • $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 Card

Shortcode output

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);

$args (array) Arguments for WP_Query. See all available .

It’s a built-in WordPress hook that allows modifying the output of the whole shortcode. Code example shown below. Read more .

βš™οΈ
here
here
Contact us
acf_views/card/query_args
acf_views/card/query_args/id={cardId}
acf_views/card/posts_data
acf_views/card/posts_data/card_id={cardId}
acf_views/card/custom_variables
acf_views/card/custom_variables/card_id={cardId}
do_shortcode_tag