Repository navigation
Latest Posts: add grid option and improve front-end rendering - #1992
Conversation
| $post_date = "<span class='wp-block-latest-posts__post-date'>{$post_the_date}</span>"; | ||
| } | ||
|
|
||
| $posts_content .= "<li><a href='{$post_permalink}'>{$post_title}</a>{$post_date}</li>\n"; |
There was a problem hiding this comment.
The return value of get_permalink() also needs to go through esc_url(), which was missed previously.
The return values of get_the_date() and get_the_title() should probably also go through esc_html().
|
|
||
| $posts_content .= "<li><a href='{$post_permalink}'>{$post_title}</a></li>\n"; | ||
| if ( $attributes['displayPostDate'] ) { | ||
| $post_date = "<span class='wp-block-latest-posts__post-date'>{$post_the_date}</span>"; |
There was a problem hiding this comment.
Should not a <time datetime='...'> element be used here?
There was a problem hiding this comment.
Yes, sounds like a good update.
| } | ||
|
|
||
| $class = 'wp-block-latest-posts ' . esc_attr( 'align' . $align ); | ||
| if ( $attributes['layout'] === 'grid' ) { |
|
@melchoyce see #1991 |
…trs added camelCasing
534ae27 to
11522a0
Compare
|
Rebased to include fix from show-count fix from |
Should we prevent flexbox from wrapping entirely until we add support for column counts? How would we know to have a fixed width for a given post in the grid if we don't know the number of columns we intend to show? |
|
We should get the date format to match (doesn't have to be here). |
It would be good to use _wpDateSettings.formats.date at some point.
|
Updated date format. It'd be nice to use |
@mtias Could we try limiting the grid to either two or three columns in a future PR? |
|
I was thinking of adding the column slider. I can see cases where it makes sense to have many in a line, specially if you use the full-width option. |
|
Okay, I was thinking just short-term — but it sounds like you're planning on implementing the columns sooner rather than later? |
|
Added issue for exporting PHP |



This enhances the latest posts block adding a "grid" layout option.
In the future, we'd want to add a columns slider like galleries have.
The front-end rendering seemed quite lackluster and wasn't rendering the date. This also fixes that.