Add time of the post with date (Gazette theme)
-
Hello !
I have a website with Gazette theme : http://www.course-de-drone.fr
I would like to add the time of the post, next to the date, on the page of the post but not on the homepage.
I am able to display the time instead of the date, editing the template-tag.php file, replacing “get_the_date” with “get_the_time”.
Here is the default code of the file :
if ( ! function_exists( 'gazette_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function gazette_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 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( '<a href="%1$s" rel="bookmark">%2$s</a>', esc_url( get_permalink() ), $time_string ); $byline = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); if ( is_single() && ( 1 == get_theme_mod( 'gazette_author_bio' ) && get_the_author_meta( 'description' ) ) ) { echo '<span class="posted-on">' . $posted_on . '</span>'; } else { echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; } } endif;Two questions :
– how can I add the time next to the date ?
– how can I make this modification only on the posts and not the homepage ?Thank you.
The blog I need help with is: (visible only to logged in users)
-
Hi there! This forum is for sites hosted on WordPress.com, however your site is hosted elsewhere using the software from WordPress.org.
Sites on .com do not have access to editing the theme files like your question requires, so to receive correct information for your site, please post your question on the WordPress.org Gazette theme forum: https://wordpress.org/support/theme/gazette.
Best of luck!
-
-
- The topic ‘Add time of the post with date (Gazette theme)’ is closed to new replies.