Skip to content

Implementing Filter for Custom Block Styles #70

Answered by gregsullivan
jhallbachner asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Josh—Thanks for posting your question!

There are a number of potential approaches here, but I'll give one that I've used in the past, and if you have any other questions or are looking for a different approach, we can discuss things further.

To show what I mean about creating a filter, let's look at the code for part of the _tw_posted_on() function:

$time_string = '<time datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
	$time_string = '<time datetime="%1$s">%2$s</time><time datetime="%3$s">%4$s</time>';
}

$time_string = sprintf(
	$time_string,
	esc_attr( get_the_date( DATE_W3C ) ),
	esc_html( get_the_date() ),
	esc_attr( get_the_modified_date( 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jhallbachner
Comment options

@gregsullivan
Comment options

Answer selected by jhallbachner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants