Site logo

Archived topic

Disabling linking to author's posts

33 replies · Started by Remez Sasson on May 25, 2015

Viewing posts 31–34 of 34

I remove the code and try adding the css you told me. But then my posts showed the last update and the published date together :S. Of course none of them have links (which is cool because that's what I wanted), but how can I remove the published date?

Try this as your function:

add_filter( 'generate_post_date_output', function( $output, $time_string ) {
	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';

	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date updated-date" 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() )
	);

	return sprintf( '<span class="posted-on">%s</span> ', // WPCS: XSS ok, sanitization ok.
		$time_string
	);
}, 10, 2 );

It should handle both things for you.

Thank you so much!!! It works perfect!!

You're welcome :)

This archived topic is closed to new replies.