How would i run a php function multiple times within a single page?

thyholyblood

New member
I have a time variable in a wordpress theme that needs to be converted from seconds to hh:mm:ss.

I have the following function:
<?php
function minutes( $seconds )
{
return sprintf( "%02.2d:%02.2d", floor( $seconds / 60 ), $seconds % 60 );
}
echo minutes( get_post_meta($post->ID, 'trt', true) );
?>

trt is the custom meta field that corresponds to the time in seconds

It is being used on a post list page so it needs to run multiple times but as it is, it is giving me
Fatal error: Cannot redeclare minutes()

Is there a better way at going at this?
 
Back
Top