Modifying twentyeleven_posted_on to show the post time
-
I’d like to modify the twentyeleven theme so that the “Posted on” meta info below the post title includes the post time as well as the post date.
I found one solution that suggests adding the_time to content.php like this:
<div class="entry-meta"> <?php twentyeleven_posted_on(); ?> at <?php the_time('g:i a') ?> </div><!-- .entry-meta -->But it seems more logical to modify the twentyeleven_posted_on function directly.
Normally I can figure out what’s going on in a theme’s code, but when it comes to functions I am lost. How would I modify the function so that it displays “posted on [the date] at [the time]”? The function looks like this:
function twentyeleven_posted_on() { printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ), esc_html( get_the_author() ) ); }Thanks for any help!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Modifying twentyeleven_posted_on to show the post time’ is closed to new replies.