I wanted wrapping month, day, and year separately inside divs and
I tried doing this
function posted_on_main_page() {
$format= '<div class="posted-date">
<div class="posted-month">%1$s</div>
<div class="posted-day">%2$s</div>
<div class="posted-year">%3$s</div>
</div>';
$month = the_time('M');
$date = the_time('j');
$year = the_time('Y');
printf($format, $month, $date, $year);
}
but for some reasons when I inspect element it displays date before everything
Jun272012<div class="posted-date">
<div class="posted-month"></div>
<div class="posted-day"></div>
<div class="posted-year"></div>
</div>
If you have another solution to wrap date separately pls help me out.
Thnx in advance!
Rather than calling the_time($format), use get_the_time($format). This returns the value, rather than echoing it immediately.