WordPress twentyten_posted_on
WordPress 3.x ushered in a new groundbreaking overhaul of the world’s most popular website content management system. Along with powerful new tools that make WordPress the modern web developer’s CMS package of choice, a new WordPress default theme was released, TwentyTen. The new TwentyTen theme ships as the default WordPress theme and replaces the old, dated Kubric default theme. TwentyTen has a more modern look and uses more modern functionality, while remaining simple enough to be used as a default theme.
WordPress recommends that theme author’s make a copy of the default theme that ships with WordPress, and use this copy as a template when creating a new custom theme. This makes perfect sense. By keeping an active version of the default WordPress theme installed, a theme author can always revert to the default theme, should a problem arise. An active default theme also serves as a great troubleshooting tool for theme authoring and plugin installation.
A common edit to the TwentyTen theme is removing the authored by listing from the post meta title, generated by a function called ‘twentyten_posted_on’. This is rather simple to resolve.
The twentyten_posted_on function is in the functions.php file, on line 273.
Remove the values for the author by changing the following code:
function twentyten_posted_on() {
printf( __( '<span>Posted on</span> %2$s <span>by</span> %3$s', 'twentyten' ),
'meta-prep meta-prep-author',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span>%3$s</span></a>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '<span><a href="%1$s" title="%2$s">%3$s</a></span>',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
get_the_author()
)
Your modified code should look like this:
function twentyten_posted_on() {
printf( __( '<span>Posted on</span> %2$s', 'twentyten' ),
'meta-prep',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span>%3$s</span></a>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
)
Now only the “Posted on Month, Day, Year” will display on post meta-titles. The author will no longer display.
