Skip to content

Instantly share code, notes, and snippets.

@congthien
Created August 30, 2017 02:40
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 congthien/b4515437b0469938d7ff95dfab992199 to your computer and use it in GitHub Desktop.
Save congthien/b4515437b0469938d7ff95dfab992199 to your computer and use it in GitHub Desktop.
add more category for post - boston theme
function boston_posted_on() {
$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_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$posted_on = sprintf(
esc_html_x( '%s', 'post date', 'boston' ),
'<span class="entry-date">' . $time_string . '</span>'
);
$byline = sprintf(
esc_html_x( '%s', 'post author', 'boston' ),
'<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>'
);
$category = get_the_category();
$cate = '';
if ( $category ) {
$cate = '<span class="entry-cate">';
foreach($category as $cat) {
$cate .= '<a class="entry-category" href="'.esc_url( get_category_link($cat->term_id ) ).'">'.$cat->cat_name.'</a> ';
}
$cate .= '</span>';
}
echo $cate.$byline.$posted_on;
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
echo '<i class="genericon genericon-comment"></i>';
comments_popup_link( '0', '1', '%' );
echo '</span>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment