I have this code in a foreach loop:
<?php $current_date[] = the_date('F Y'); ?>
What Im trying to do is gather all the dates into an array
but when I print_r my array, nothing appears...how would I fix this?
I have this code in a foreach loop:
<?php $current_date[] = the_date('F Y'); ?>
What Im trying to do is gather all the dates into an array
but when I print_r my array, nothing appears...how would I fix this?
the_date
is an echo, use
<?php $current_date[] = the_date('F Y', '','', false); ?>
the false
turns the echo off.
http://codex.wordpress.org/Function_Reference/the_date
or as Pekka has it get_the_date('F Y');