Support » Plugin: Pods - Custom Content Types and Fields » Calculate datediffs

  • Resolved srednasoft


    Is it possible to have a custom field that calculates the number of years from another custom fields date value?

    For example: This could be a dynamic value for a persons age.

    Or, could a datediff be calculated directly on the page for a custom post type. I’m using Elementor Pro to build the custom single pages.

    • This topic was modified 1 month ago by  srednasoft.
Viewing 1 replies (of 1 total)
  • Plugin Author Jim True


    Unless Elementor Pro allows you to do calculations directly on a dynamically populated field, you’re not going to be able to do this in Elementor Pro.

    You’ll need to call the field through a Pods Template (in an HTML block to call a shortcode), ie:


    Where you’re passing the field into a display output filter (another function you’re going to need to put in your functions.php or a Code Snippets Plugin. Here’s the documentation on what Display Filters are:

    And here’s an example function that calculates ‘age in days’ from the date field provided:

    function return_age($input_date) {
    	$now = date("Y-m-d");
    	return date_diff(date_create($input_date), date_create($now))->format('%a days ago');

    you would call that with {@date_field,return_age}

    You’ll need to find the necessary PHP to calculate your datediff.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.