From 7b94247dce234d3cf88c51bb2c2af9d58eb287f2 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 15 Mar 2018 22:37:42 +0000 Subject: [PATCH] Adding custom CSS support in Latest Posts Block Latests post block was missing className from attributes as well as conditional statement for applying a class --- blocks/library/latest-posts/index.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blocks/library/latest-posts/index.php b/blocks/library/latest-posts/index.php index bb06d4b4fe5a5..b391ac794496d 100644 --- a/blocks/library/latest-posts/index.php +++ b/blocks/library/latest-posts/index.php @@ -56,6 +56,10 @@ function render_block_core_latest_posts( $attributes ) { $class .= ' columns-' . $attributes['columns']; } + if ( isset( $attributes['className'] ) && ! empty( $attributes['className'] ) ) { + $class .= ' ' . $attributes['className']; + } + $block_content = sprintf( '', esc_attr( $class ), @@ -102,6 +106,9 @@ function register_block_core_latest_posts() { 'type' => 'string', 'default' => 'date', ), + 'className' => array( + 'type' => 'string', + ), ), 'render_callback' => 'render_block_core_latest_posts', ) );