Post date on two seperate lines
-
Hi, I’m using a Twenty Ten child theme. I can’t figure out how to style/code my entry-meta onto 2 separate lines. Right now, it reads: “Date: 10.24.12” on one line, and I would like it to read “Oct” on one line and “24” on the line below.
How do I do this? Please help!
-
You need to create different CSS and change the format your theme uses to display the date.
http://codex.wordpress.org/Formatting_Date_and_Timeyou need to edit the function
twentyten_posted_on()
in functions.php of Twenty Ten;which you seem to have done already;
break the single
get_the_date()
intoget_the_date('M')
andget_the_date('d')
orget_the_date('j')
for details, please post the code as you have it now.
Hi,
So I managed to change the date format but still can’t “Oct” and “24” on 2 separate lines. Here is my functions.php code. Any ideas on how to do this??
[code moderated - the posted code was corrupted;
please use the pastebin for large amounts of code - http://codex.wordpress.org/Forum_Welcome#Posting_Code ]your posted code was corrupted by getting posted without being marked with the code buttons;
also it is recommended to use the http://pastebin.com/ for larger amounts of code.please repost the code – http://codex.wordpress.org/Forum_Welcome#Posting_Code
My apologies! Here is the URL for the code in pastebin. Hopefully that works.
example (relevant section only; unnecessary code removed):
function twentyten_posted_on() { printf( __( '<span class="%1$s"></span> %2$s ', 'twentyten' ), 'meta-prep meta-prep-author', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"></a><span class="entry-date">%3$s<br />%4$s</span>', get_permalink(), esc_attr( get_the_time() ), '<span class="entry-date-month">'.get_the_date('M').'</span>', '<span class="entry-date-day">'.get_the_date('d').'</span>' ) ); }
as you can see, in this section, the date is output in two bits, separated by a linebreak:
<span class="entry-date">%3$s<br />%4$s</span>
and the two bits are generated here:
'<span class="entry-date-month">'.get_the_date('M').'</span>', '<span class="entry-date-day">'.get_the_date('d').'</span>'
these two lines was just this before:
get_the_date()
Thanks! That worked beautifully.
- The topic ‘Post date on two seperate lines’ is closed to new replies.