Site logo

Archived topic

Make post dates clickable

5 replies · Started by Jane on November 14, 2022

Viewing posts 1–6 of 6

Hi Jane,

Can you link us to your site where we can see the date? The article is published 14 years ago, I don't think the info is up to date.

And where do you want the date to link to?

Try this PHP snippet:

add_filter('generate_post_date_output', function($output, $time_string){
		$posted_on = '<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ';
			printf(
				$posted_on,
				apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ),
				esc_url( get_day_link( get_the_time( 'Y' ), get_the_time( 'm' ), get_the_time( 'd' ) ) ),
				esc_attr( get_the_time() ),
				$time_string
			);
},10,2 );

That worked like a dream! Thank you SO much.

You are welcome :)

This archived topic is closed to new replies.