[Resolved] Updated Date Meta from GeneratePress

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Updated Date Meta from GeneratePress

Tagged: 

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #4151
    Tom
    Keymaster

    Here’s what I’m seeing: https://www.screencast.com/t/1bqa9qU5ct

    The updated date is March 24, and that’s what I see on the actual post in the WPSP list.

    Let me know 🙂

    #4250
    Todd
    Participant

    Tom, just checking in on this one when you have time.

    #4337
    Todd
    Participant

    Hi Tom, I am hoping to launch this site soon, and was hoping I could get the updated dates to show in WPSP? Any help would be much appreciated. Let me know if you need access to the site.

    Thank you.

    #4379
    Todd
    Participant

    Tom, Seems like you made an update to updated dates in GP but I still can not get this to work for WPSP?

    It shows the correct updated date, but not the words “Updated”, should just add content Before CSS? I was just concerned about the Google aspects of a solution like adding CSS this way.

    I mo=ust be doing something wrong given the CSS class for the date is .wp-show-posts-updated

    I am using the following Snippet to change the dates to Updated in GP.

    if ( ! function_exists( 'generate_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function generate_posted_on() 
    {	
    	$date = apply_filters( 'generate_post_date', true );
    	$author = apply_filters( 'generate_post_author', true );
    	//if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) 
    		$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%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() )
    	);
    	
    	// If our date is enabled, show it
    	if ( $date ) :
    		printf( '<span style="float: left; margin-right: 3px;">Updated:</span><span class="posted-on">%1$s</span>',
    			sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    				esc_url( get_permalink() ),
    				esc_attr( get_the_time() ),
    				$time_string
    			)
    		);
    	endif;
    	
    	// If our author is enabled, show it
    	if ( $author ) :
    		printf( ' <span class="byline">%1$s</span>',
    			sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
    				__( 'by','generatepress'),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
    				esc_html( get_the_author() )
    			)
    		);
    	endif;
    	
    }
    endif;
    #4387
    Tom
    Keymaster

    Sorry, Todd! The forum wasn’t notifying me of your replies for some reason.

    To add the Updated text, you can just do this:

    .wp-show-posts-updated:before {
        content: "Updated: ";
    }
    #4388
    Todd
    Participant

    Thanks Tom, worked like a charm. No worries.

    #4396
    Tom
    Keymaster

    Awesome 🙂

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.