Total Builder Element 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:


Array Values: Since Total 5.5 you can any value that is an array can be defined using a comma separated string. So instead of doing the following:


You can now simply do:


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
Whitelisting Callbacks - Important! Your callback functions must be whitelisted in order for them to work. This is an important security measure.
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.