-
-
Save billerickson/b5765d42cef2d63ca7fc60366a0d32a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display Posts, FacetWP Support | |
* @see https://displayposts.com/2019/04/20/facetwp-support/ | |
* | |
*/ | |
function be_dps_facetwp( $args, $atts ) { | |
if( !empty( $atts['facetwp'] ) && filter_var( $atts['facetwp'], FILTER_VALIDATE_BOOLEAN ) ) | |
$args['facetwp'] = true; | |
return $args; | |
} | |
add_filter( 'display_posts_shortcode_args', 'be_dps_facetwp', 10, 2 ); | |
/** | |
* FacetWP support in custom queries | |
* @see https://facetwp.com/documentation/templates/wp-query/ | |
* | |
*/ | |
add_filter( 'facetwp_is_main_query', function( $bool, $query ) { | |
return ( true === $query->get( 'facetwp' ) ) ? true : $bool; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment