Last active
October 26, 2020 01:01
-
-
Save neilgee/5b1584707cff899679235d62d4488c39 to your computer and use it in GitHub Desktop.
Beaver Builder Filtering The Loop
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 | |
add_filter( 'fl_builder_loop_query_args', 'prefix_fl_builder_loop_query_args_filter' ); | |
/** | |
* Filter Beaver Builder Loop in Modules - to output a certain Taxonomy | |
* @since 1.0.0 | |
*/ | |
function prefix_fl_builder_loop_query_args_filter( $query_args ) { | |
if ( 'id-goes-here' == $query_args['settings']->id ) { // Set an ID in module | |
$query_args = array( | |
'tax_query' => array( | |
array ( | |
'taxonomy' => 'taxonomy-goes-here', // Add in Taxonomy | |
'operator' => 'EXISTS', // This operator ensures all relevant terms are output | |
) | |
), | |
); | |
} | |
return $query_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment