fazarcon

date published

Aug 15th, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
  2. if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-date' ) !== false ) {
  3.  
  4. if( empty ($content) ){
  5. $post_date = sprintf(
  6. '<time class="entry-date published" datetime="%1$s">%2$s</time>',
  7. esc_attr( get_the_date( 'c' ) ),
  8. esc_html( get_the_date( '' ) )
  9. );
  10. return $post_date;
  11. }
  12. }
  13. return $content;
  14. }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment