Skip to content

Instantly share code, notes, and snippets.

@herbie4
Created July 17, 2024 13:51
Show Gist options
  • Save herbie4/cef598f9dfff483fe08d5ec948150e23 to your computer and use it in GitHub Desktop.
Save herbie4/cef598f9dfff483fe08d5ec948150e23 to your computer and use it in GitHub Desktop.
Avada Postcards can use multiple custom post types by changing the query arg
<?php
// used on postcard blocks for Avada theme
// use the hook fusion_post_cards_shortcode_query_args to change to multiple post types on the postcard
// -----------------------------
// change the number 75012 in fusion_is_post_card to match the required ID of the post card!
// also change the cpt names as required
// place this snippet in functions.php of child theme or use a code snippet plugin to add it
// -----------------------------
function hhdev_my_post_card_add_cpt( $query_args ) {
if(fusion_is_post_card(75012)) $query_args['post_type'] = array('book','store','message');
return $query_args;
}
add_filter( 'fusion_post_cards_shortcode_query_args', 'hhdev_my_post_card_add_cpt', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment