I have been receiving the following errors for some time:
PHP Warning: A non-numeric value encountered in /home/user/public_html/wp-content/themes/mytheme/content-one.php on line 29
PHP Warning: A non-numeric value encountered in /home/user/public_html/wp-content/themes/mytheme/content-one.php on line 30
Those lines are:
$minutes = floor($duration_in_seconds / 60);
$seconds = $duration_in_seconds % 60;
PHP Version: 7.3.20
Can anyone help me with some advice, how to fix this issue? Thank you!
$duration_in_secondsdoesn't contain a numeric value, therefore the math operations are failing. I'd suggest you print their values to see what is going on. - dbaltor$duration_in_seconds = get_post_meta($post->ID, 'duration', true); $minutes = floor($duration_in_seconds / 60); $seconds = $duration_in_seconds % 60; echo $minutes . ":" . str_pad($seconds, 2, "0", STR_PAD_LEFT);- user2151960