Twenty Twelve
[resolved] display last post modified date (8 posts)

  1. Arafin Shaon
    Posted 3 years ago #

    Can anyone help me to display post last modified date instead of post published date in twentytwelve theme :) Its because I want search engine to display my post last modified date.

  2. delevega
    Posted 3 years ago #

  3. Arafin Shaon
    Posted 3 years ago #

    I know the reference but not being able to implement it properly :(

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    in a child theme of Twenty Twelve, create functions.php, and add the edited code of the 'twentytwelve_entry_meta()' function;



    function twentytwelve_entry_meta() {
    	// Translators: used between list items, there is a space after the comma.
    	$categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );
    	// Translators: used between list items, there is a space after the comma.
    	$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_modified_time() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_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() ) ),
    	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	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' );


    you might also want to edit this text: entry was posted .... on %3$s


    what search engines display might not be influenced by that output(?)

  5. Arafin Shaon
    Posted 3 years ago #

    Thanks a ton sir :) I've created a child theme for Twenty Twelve and added the code snippet lets see what happen.

  6. Arafin Shaon
    Posted 2 years ago #

    Sorry to say that it doesn't work :( google doesn't display post updated date :(

  7. Arafin Shaon
    Posted 2 years ago #

    my problem's solved. :)

  8. granthill
    Posted 2 years ago #

    Is there any way you can post a functions file for how to get the modified date AND the original post date?

    I'm looking to have my site display something like: "This entry was posted on [original date]. Last modified on [modified date]"

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic