printf and comments_number() order
-
I’m customizing the starkers theme which re-uses a lot of the twentyten functions. I’d like to display the post meta data using this modified twentyten_posted_on() function.
function twentyten_posted_on() { printf( __( '%2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ), 'meta-prep meta-prep-author', sprintf( '<span class="entry-date">%3$s</span>', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', ( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), get_the_author() ), sprintf( '<span>%1$s</span>', comments_number('No Comments', '1 Comment', '% Comments') ) ); } endif;
For some reason it’s outputs “No CommentsOctober 6, 2010 by bzmillerboy” instead of “October 6, 2010 by bzmillerboy No Comments”.
I finally had to pull the comments_numbers out of the functions.php and put it after the function on the single.php, like this.
<?php twentyten_posted_on(); ?> <?php comments_number('No Comments', '1 Comment', '% Comments') ?>
Any suggestions on how to get this to work within the function?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘printf and comments_number() order’ is closed to new replies.