Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created Apr 20, 2019
Embed
What would you like to do?
<?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