michaelmcguk
Member
Posted 1 year ago #
Hi,
Can anyone help me use the substr PHP function with the 'the_time' function.
<div class="calendar">
<?
// $month = substr(the_time('S'(0,3)));
?>
<p class="month"><?php echo $month; ?>
<p class="date"><?php the_time('F j') ?>
</div>
I had hoped the above would display the first three letters of the month, but seem to be getting errors :(
Please help.
the_time doesn't return the time, it echoes it. So that first line you've got commented out doesn't do anything. (Also, check your parentheses in the substr command.)
You want get_the_time.
$month = substr( get_the_time('S'), 0, 3 );
Although this command doesn't make sense to me. Why not just use
the_time('M'), which returns the three-letter abbreviation for the month?
michaelmcguk
Member
Posted 1 year ago #
Heh oh man do I full thick.
Didn't realise you could do the_time('M')
*hangs head in shame*