这是我网页上日期格式的 php 代码
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()
)
);
}
它给了这个
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>
我想要的是仅在主页上将月份、日期和年份分别包装在 div 中:
<div class="month">March</div>
<div class="date">31</div>
<div class="year">2012</div>