This is the php code for date format on my web page
function starkers_posted_on() {
printf( __( 'Posted on %2$s by %3$s', 'starkers' ),
'meta-prep meta-prep-author',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s" pubdate>%4$s</time></a>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date('Y-m-d'),
get_the_date()
),
sprintf( '<a href="%1$s" title="%2$s">%3$s</a>',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'starkers' ), get_the_author() ),
get_the_author()
)
);
}
it gives this
Posted on <a href="#" title="23:50" rel="bookmark">
<time datetime="2012-03-31" pubdate="">March 31 2012</time>
</a> by <a href="#" title="View all posts by me">me</a>
What I want is to wrap Month, date, and year separately inside divs like this only on the main page:
<div class="month">March</div>
<div class="date">31</div>
<div class="year">2012</div>
You can do this by passing in a format string parameter into the
get_the_date()function like this:You could do something like this:
UPDATE
Or like this in your index.php file (from your themes folder):
The format strings use here are as follows:
F= Month (as a word)j= Day of the month (number)Y= Year (as 4 digits)Check the docs here.