Skip to content

Advanced Queries

When using theme elements that display posts such as the Post Cards element (which is really the only element you should use to display posts) there are built-in settings for controlling the posts that are shown so you can choose how many to display, include or exclude terms, change the order, etc…However, if you need more complex queries the theme does offer an “Advanced” Query type which allows you to return the exact arguments you need for your query.

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 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.
Back To Top