Skip to content

Commit

Permalink
[Fix] Make sure Latest Posts alignment class behaviour (#8847)
Browse files Browse the repository at this point in the history
* Make sure Latest Posts block doesn't apply alignment classes if no alignment is selected

* Blocks: Fix Latest Posts align assignment alignment
  • Loading branch information
Nahid F. Mohit authored and aduth committed Aug 13, 2018
1 parent eeb298e commit 070c26f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/block-library/src/latest-posts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ function render_block_core_latest_posts( $attributes ) {
$list_items_markup .= "</li>\n";
}

$class = "wp-block-latest-posts align{$attributes['align']}";
$class = 'wp-block-latest-posts';
if ( isset( $attributes['align'] ) ) {
$class .= ' align' . $attributes['align'];
}

if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
$class .= ' is-grid';
}
Expand Down Expand Up @@ -98,8 +102,7 @@ function register_block_core_latest_posts() {
'default' => 3,
),
'align' => array(
'type' => 'string',
'default' => 'center',
'type' => 'string',
),
'order' => array(
'type' => 'string',
Expand Down

0 comments on commit 070c26f

Please sign in to comment.