We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Updated Date Meta from GeneratePress Reply To: Updated Date Meta from GeneratePress

#3920
Tom
Keymaster

I need to make this adjustment in the core plugin, but we can try this for now:

add_filter( 'wpsp_date_output', 'tu_wpsp_updated_date_first' );
function tu_wpsp_updated_date_first() {
	$time_string = '';
	
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
	}
	
	$time_string .= '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$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
	$output = sprintf(
		'<span class="wp-show-posts-posted-on wp-show-posts-meta">
			<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>
		</span>',
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		$time_string
	);

	return $output;
	
}

Then add this CSS:

.wp-show-posts-updated {
    display: inline-block;
}

.wp-show-posts-updated + .wp-show-posts-entry-date {
    display: none;
}

Let me know if that works or not 🙂