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 Remove from Meta date? Reply To: Remove from Meta date?

#5049
Tom
Keymaster

Hey Chris,

To remove the link and show the updated date, you can do this:

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">
			%1$s
		</span>',
		$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 this helps or not 🙂