This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'gv_age', 'gv_calculate_age' ); | |
/** | |
* Calculate age in years based on entry data | |
* | |
* Usage inside a Custom Content field (Replace "2" with the ID of the date field): | |
* | |
* <code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'gv_days', 'gv_calculate_days' ); | |
function gv_calculate_days( $atts ) { | |
global $gravityview_view; | |
extract($gravityview_view->field_data); // create a $entry variable with current entry data array | |
extract( shortcode_atts( | |
array( | |
'start_date_id' => '', | |
'end_date_id' => '', |