Thread Starter
bobdeo
(@bobdeo)
ok thanks… but when I write
<span class="day"><?php the_date('j') ?></span>
<span class="month"><?php the_date('F') ?></span>
<span class="year"><?php the_date('Y') ?></span>
Only the first one is on the screen…
From that page:
When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() with a date-specific format string.
Thread Starter
bobdeo
(@bobdeo)
The date for the first post -> that’s what I want. But I need to split day, month and year to apply a style to each (not the same for the 3).
Well then you’ll need to use the_time() or something because as it says, the_date() only works once.
e.g.;
the_time('M');
the_time('Y');
the_time('j');
What about
the_date('<span class="day">j</span> <span class="month">F</span> <span class="year">Y</span>')
Yeah, I was gonna suggest that, but I was too lazy to type it out as you need to escape a lotta characters in there with backslashes (all the ones that are real format characters).
Thread Starter
bobdeo
(@bobdeo)
the_date('<span class="day">j</span> <span class="month">F</span> <span class="year">Y</span>')
that’s sound good but not working… someone can correct it, I’m a newbie in php š
As I said, you need to escape all the letters there are codes for stuff.
the_date(‘<\sp\a\n \c\l…
the_date(‘\<\s\p\a\n \c\l\a\s\s\=\”\d\a\y\”\>j\<\/\s\p\a\n\> \<\s\p\a\n \c\l\a\s\s\=\”\m\o\n\t\h\”\>F\<\/\s\p\a\n\> \<\s\p\a\n \c\l\a\s\s\=\”\y\e\a\r\”\>Y\<\/\s\p\a\n\>’);
You don’t technically need to escape every single character there, especially the < and >, but oh well. š