Back to contents

JetEngine: 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 tag allows you to display values calculated according to the chosen function. It is a dynamic tag, so you can use it in any widget that allows dynamic tag usage. You can use this tag in combination with the Listing Grid, for example. This tag can take the values from the defined meta field of all the CPT items, do calculations according to the function and show the result.

Where can you find the Dynamic Function tag?

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.

dynamic tags button

Just select the “Dynamic Function” option in the list and click on it. 

Dynamic Function Settings

dynamic function settings

Function 

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.

Data Source

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). 

Field Name 

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.

Decimal Point 

Here you can set how the decimal point will look like. It can be any symbol you want, including letters and numbers.

Thousands separator 

This bar allows you to set how the thousands separator will look like and it can also be any symbol you see fit, including letters or numbers.

Decimals Count 

Here you can set how many numbers after the decimal point will be shown.

How to use the Minimal Value Dynamic Function?

You can use the Dynamic Function tag to display the “Price from” information. For example, you are creating a rental website and want to show from what minimal number starts the price per day. 

Let’s assume you have a Listing Grid on the page that shows the available rooms on the page. Go to that page, find the Heading widget and drop it on the workspace over the Listing Grid. In the Title text area, click on the “Dynamic tags” button and choose the Dynamic Function option.

dynamic function minimal value

In the Function drop-down menu, choose the “Minimum value” option and choose “Post Meta” in the Data Souce list. In the Field Name bar, type in the name of the price meta field. Set all the other features so they will suit your needs. If you want to add some text, do it in the Before and After bard of the Advanced tab.

dynamic function minimal value

Here’s how it can look like on the frontend of the car renting site after a little styling:

dynamic function minimal value example

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. Good luck adding convenient details to your website!