Total Builder Modules Advanced Query Setting

Various Total builder modules include the ability to select what posts are being displayed, of course these are limited to the settings available (Offset, include/exclude categories, orderby, order…etc) so if you need something more advanced you can use enable the “Advanced Query” setting as shown in the screenshot below.

Once the setting is enabled you will see a new field named “Query Parameter String or Callback Function Name”. Here is where you will enter your advanced query settings and you have 2 options:

  1. You can enter a Query String
  2. You can enter a custom callback function

Query String

A query string is a string that contains parameters which looks something like this:


Arrays: Note how arrays are expressed in the query string above (the tax_query). Keep this in mind since most advanced queries will likely require array values.

Dynamic Values: The theme has various dynamic values you can use in the query, for example if you need to exclude the current post or display items from the current post author. Learn more here →

Callback Function

In Total 4.9.9 the Advanced Query setting was updated to allow you to insert a callback function name this way you could define a function to be used to return your custom Query parameters. This is great to support 3rd party plugins which have helper functions built-in for this sort of thing or for managing your queries via your child theme which can be much better.

To use a callback for your query arguments simply enter your function name in the field and then add this function to your child theme's functions.php file. Your function should have a unique name and return an array of the arguments to pass onto WP_Query.

Advanced Query Callback Function
Advanced Query Callback Function in Child Theme
Building your queries: Check out the WordPress WP_Query Codex for all the different parameters you can use in the your query.