I am using Advanced Custom Fields for Wordpress. I have two fields - 'Score One' and 'Score Two' which are text fields that allow the user to input a number.
In addition to showing these fields, I'd like to be able to get an average of the two numbers and show that as well.
For example...
<?php the_field('score_one'); ?>
Gives me....80
<?php the_field('score_two'); ?>
Gives me....60
How can I calculate the average of the above two scores on the front end and show that as a third number?
Any help appreciated.
echo (the_field('score_one') + the_field('score_two')/2 ;
pay attention that your value are not null nor something else than integer.