Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 20, 2019 13:11
Show Gist options
  • Save billerickson/b5765d42cef2d63ca7fc60366a0d32a9 to your computer and use it in GitHub Desktop.
Save billerickson/b5765d42cef2d63ca7fc60366a0d32a9 to your computer and use it in GitHub Desktop.
<?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