Dynamic Function Overview
From this tutorial, you will learn how to set the Dynamic Function to display average, minimum, and maximum values from the meta fields of listing items on the page.
Dynamic Function Location
Like all the other dynamic tags, Dynamic Function can be found in almost every Elementor widget. To open the dynamic tags list, you have to click on the special button with a cylinder-shaped icon.
Just select the “Dynamic Function” option in the list and click on it.
Here you can choose what calculations will be applied to the values of the chosen field:
- Summed value – adds all the values and shows the sum;
- Average value – takes all the values, adds them, and divides by their number to show the average;
- Count – counts the number of post/term/user items where the chosen field is not empty;
- Maximum/Minimum value – takes all the values from the chosen field, compares them, and displays the maximal/minimal one.
Here, you can choose where to take the data from – Post, Term, or User meta fields.
If you have chosen the Post Meta option, you will be additionally asked to specify the Data Context. This is a drop-down where you can get more specific about the post type. The options are:
- All posts – the values will be taken from all posts;
- Posts from current term – you can set the term in the Taxonomy drop-down, and the values will be taken only from the posts of that taxonomy;
- Posts by current user – the values will be taken from the posts created by the current user;
- Posts by queried user – you can specify the user in the Set user ID/login/email bar, and the values will be taken from the posts created by that user.
Besides that, if you have chosen the Post Meta option, you will be allowed to query the posts from which the values will be taken by status (in the Query by posts with status field) or by type (in the Query by posts with type drop-down menu).
You have to put the name of the meta field into this bar. The Dynamic Function will take the values from that field in all posts to which it is attached and do the calculation according to the Function.
Here you can set how the decimal point will look like. It can be any symbol you want, including letters and numbers.
This bar allows you to set how the thousands separator will look, and it can also be any symbol you see fit, including letters or numbers.
Here you can set how many numbers after the decimal point will be shown.
That’s all about Dynamic Function settings. Of course, you can use it in different ways not described in this tutorial, like displaying the average rating of the items.