WordPress.org

Forums

How to remove timestamp from Twenty Fourteen theme? (6 posts)

  1. benthomaspayne
    Member
    Posted 1 year ago #

    I know this question has been asked a gajillion times, but I cannot for the life of me find how to remove the timestamp from posts in the Twenty Fourteen theme. I've looked for the lines of code that people mention, but can't find them in the Editor.

  2. vtxyzzy
    Member
    Posted 1 year ago #

    I think the code you want is in the themes/twentyfourteen/inc/template-tags.php file in the function twentyfourteen_posted_on().

  3. MarkieMarc
    Member
    Posted 10 months ago #

    It seems to be quit hard to get this issue fixed.
    I believe the function is in the template-tags.php file. But what are we supposed to do next? Copy this file into the child theme path without the lines: [if ( ! function_exists( 'twentyfourteen_posted_on' ) ) :

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    /**
     * Print HTML with meta information for the current post-date/time and author.
     *
     * @since Twenty Fourteen 1.0
     */
    function twentyfourteen_posted_on() {
    	if ( is_sticky() && is_home() && ! is_paged() ) {
    		echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
    	}
    
    	// Set up and print post meta information.
    	printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a href="%4$s" rel="author">%5$s</a></span></span>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		get_the_author()
    	);
    }]

    ? Or put some kind of code in a new function.php file in the child theme folder, like some people suggest in other posts?

  4. vtxyzzy
    Member
    Posted 10 months ago #

    You can hide the date with CSS. Put this at the end of you child theme's style.css:

    span.entry-date { display: none; }
  5. MarkieMarc
    Member
    Posted 10 months ago #

    Hi vtxyzzy,

    What I actually meant is to delete the date from the snippet in Google. The code you mentioned is only for not displaying on the front end I think....

  6. vtxyzzy
    Member
    Posted 10 months ago #

    OK, try again. Put this function in your child theme's functions.php file:

    function twentyfourteen_posted_on() {
    	if ( is_sticky() && is_home() && ! is_paged() ) {
    		echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
    	}
    
    	// Set up and print post meta information.
    		printf( '<span class="byline"><span class="author vcard"><a href="%1$s" rel="author">%2$s</a></span></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			get_the_author()
    		);
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic