Instantly share code, notes, and snippets.

@neilgee /loop.php
Last active Oct 27, 2018

Embed
What would you like to do?
Beaver Builder Filtering The Loop
<?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