File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,15 +43,20 @@ function render_block_core_rss( $attributes ) {
4343 }
4444 $ title = "<div class='wp-block-rss__item-title'> {$ title }</div> " ;
4545
46- $ date = '' ;
47- if ( $ attributes ['displayDate ' ] ) {
48- $ date = $ item ->get_date ( 'U ' );
46+ $ date_markup = '' ;
47+ if ( ! empty ( $ attributes ['displayDate ' ] ) ) {
48+ $ timestamp = $ item ->get_date ( 'U ' );
49+
50+ if ( $ timestamp ) {
51+ $ gmt_offset = get_option ( 'gmt_offset ' );
52+ if ( is_numeric ( $ gmt_offset ) ) {
53+ $ timestamp += (int ) ( (float ) $ gmt_offset * HOUR_IN_SECONDS );
54+ }
4955
50- if ( $ date ) {
51- $ date = sprintf (
56+ $ date_markup = sprintf (
5257 '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ' ,
53- esc_attr ( date_i18n ( 'c ' , $ date ) ),
54- esc_attr ( date_i18n ( get_option ( 'date_format ' ), $ date ) )
58+ esc_attr ( date_i18n ( 'c ' , $ timestamp ) ),
59+ esc_html ( date_i18n ( get_option ( 'date_format ' ), $ timestamp ) )
5560 );
5661 }
5762 }
@@ -85,7 +90,7 @@ function render_block_core_rss( $attributes ) {
8590 $ excerpt = '<div class="wp-block-rss__item-excerpt"> ' . esc_html ( $ excerpt ) . '</div> ' ;
8691 }
8792
88- $ list_items .= "<li class='wp-block-rss__item'> {$ title }{$ date }{$ author }{$ excerpt }</li> " ;
93+ $ list_items .= "<li class='wp-block-rss__item'> {$ title }{$ date_markup }{$ author }{$ excerpt }</li> " ;
8994 }
9095
9196 $ classnames = array ();
You can’t perform that action at this time.
0 commit comments