How to Remove Posting Date from WordPress Default Themes
There are times that we don't want the posting date to show on our WordPress posts or pages, there are two ways to remove them. The css way and the function.php way, both of them are applied on Child Themes because its not wise to edit the Basic Theme itself, in the guide below I'm going to use the latter one.
How to remove the WordPress posting date using Child Theme Functions.php
WARNING: Always generate a backup before you start editing your WP files
First of all you need to create a child theme for each of the WP Default Themes, you can follow this guide in order to create child themes for any of the WordPress Default Themes, Twenty Eleven, Twenty Twelve or Twenty Thirteen.
Just in case I've already uploaded the child theme files, you can use them for our guide below right away.
Remove Posting Date from Twenty Eleven Theme
Open functions.php file of the Twenty Eleven Child Theme and between
<?php ?>
insert the following:
if ( ! function_exists( 'twentyeleven_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. * Create your own twentyeleven_posted_on to override in a child theme * * @since Twenty Eleven 1.0 */ 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">%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' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ), get_the_author() ); } endif;Download Twenty Eleven Child No Posting Dates Theme
Remove Posting Date from Twenty Twelve Theme
Open functions.php file of the Twenty Twelve Child Theme and between
function twentytwelve_entry_meta() { $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) ); $date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); if ( $tag_list ) { $utility_text = __( 'This entry was posted in %1$s<!-- and tagged %2$s on %3$s--><span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } elseif ( $categories_list ) { $utility_text = __( 'This entry was posted in %1$s<!-- on %3$s--><span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } else { $utility_text = __( 'This entry was posted<!-- on %3$s--><span class="by-author"> by %4$s</span>.', 'twentytwelve' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); }Download Twenty Twelve Child No Posting Dates Theme
Remove Posting Date from Twenty Thirteen Theme
Open functions.php file of the Twenty Thirteen Child Theme and between
<?php ?>
insert the following:
if ( ! function_exists( 'twentythirteen_entry_date' ) ) : /** * Prints HTML with date information for current post. * * Create your own twentythirteen_entry_date() to override in a child theme. * * @since Twenty Thirteen 1.0 * * @param boolean $echo Whether to echo the date. Default true. * @return string The HTML-formatted post date. */ function twentythirteen_entry_date( $echo = false) { if ( has_post_format( array( 'chat', 'status' ) ) ) $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' ); else $format_prefix = '%2$s'; $date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ), esc_attr( get_the_date( 'c' ) ), esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) ); if ( $echo ) echo $date; return $date; } endif;Download Twenty Thirteen Child No Posting Dates Theme
Feel free to post your comments in case you have any questions.
myhero
September 27, 2013 at 4:37 pm
Hi,
THanks for this I was looking for something like this. Twenty thirteen also adds the category, how can I remove all info associated with a post (date, title, category)?
Jeanette
December 13, 2013 at 4:36 pm
Thanks for this great and helpful post. I tried it and it worked immediately.
Would you publish the code that is needed to publish the date of the last update / modification of the post (instead of the posting date)?
Fix My WP
December 13, 2013 at 6:19 pm
Thanks Jeanette!
I’ll post the code for your request soon enough.