Support is closed now. We shall check all on 20th May 2024.

Premium add-on for Bricks Builder

Custom WP Query

Bricks Builder loop builder is a powerful tool for any site. It is very flexible and you can make unlimited custom providers. BricksUltimate made one custom provider “Custom WP Query Builder” and users can build custom WP queries for their content like posts, pages, cpts.

Custom WP Query
Custom WP Query

You will select the “Ultimate Query Builder” from the Query Posts Type dropdown. You will get a code editor and put the query arguments there like in the above screenshot. There have tons of tutorials on the net and you can easily make the query args. At first, you will follow these two links and understand the query parameter for WP Query.

  1. https://developer.wordpress.org/reference/classes/wp_query/
  2. https://luetkemj.github.io/wp-query-ref/
  3. https://rudrastyh.com/wordpress/meta_query.html

Will It Work with Taxonomy?

Yes. I said that you can build any type of query (like meta query, date query, tax query, etc) with this custom provider. I already tested and built a category filterable page for the WooCommerce products.

I used the following query arguments in the code.

<?php $query_args = [ 'post_type' => 'product',
	'post_status' 		=> 'publish',
	'posts_per_page' 	=> 8,
	'tax_query' 		=> [
		'relation'	=> 'AND'
	],
	'orderby' 			=> 'title',
	'order' 			=> 'ASC'
];

if( isset( $_GET['cat'] ) ) {
	$query_args['tax_query'][] = [
		'taxonomy' 	=> 'product_cat',
		'field' 	=> 'slug',
		'terms' 	=> [ esc_html( $_GET['cat'] ) ],
		'operator' 	=> 'IN'
	];
}

return $query_args;

Connect with WPGB Facets

We can also connect the WP Grid Builder’s facets with this custom wp query provider. Checkout the video below