Skip to content

Instantly share code, notes, and snippets.

@timelsass
Created July 27, 2017 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timelsass/a802d21ca2771d52c000e5befbacfd7c to your computer and use it in GitHub Desktop.
Save timelsass/a802d21ca2771d52c000e5befbacfd7c to your computer and use it in GitHub Desktop.
BoldGrid child theme removing "Posted On Date" from posts
<?php
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @see: https://www.boldgrid.com/support/question/in-the-blog-how-can-i-remove-the-posted-on-date-text/
*/
function boldgrid_posted_on() {
if ( is_archive() ) {
return;
}
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
_x( 'Posted on %s', 'post date', 'bgtfw' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
$byline = sprintf(
_x( 'by %s', 'post author', 'bgtfw' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment