Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions packages/block-library/src/rss/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,17 @@ function render_block_core_rss( $attributes ) {
$list_items .= "<li class='wp-block-rss__item'>{$title}{$date}{$author}{$excerpt}</li>";
}

$classes = 'grid' === $attributes['blockLayout'] ? ' is-grid columns-' . $attributes['columns'] : '';
$list_items_markup = "<ul class='wp-block-rss{$classes}'>{$list_items}</ul>";
$class = 'wp-block-rss';

if ( 'grid' === $attributes['blockLayout'] ) {
$class .= ' is-grid columns-' . $attributes['columns'];
}

if ( ! empty( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}

$list_items_markup = "<ul class='{$class}'>{$list_items}</ul>";

// PHP 5.2 compatibility. See: http://simplepie.org/wiki/faq/i_m_getting_memory_leaks.
$rss->__destruct();
Expand All @@ -96,38 +105,41 @@ function register_block_core_rss() {
register_block_type( 'core/rss',
array(
'attributes' => array(
'columns' => array(
'type' => 'number',
'default' => 2,
),
'blockLayout' => array(
'type' => 'string',
'default' => 'list',
),
'feedURL' => array(
'type' => 'string',
'default' => '',
'className' => array(
'type' => 'string',
),
'itemsToShow' => array(
'columns' => array(
'type' => 'number',
'default' => 5,
'default' => 2,
),
'displayExcerpt' => array(
'displayAuthor' => array(
'type' => 'boolean',
'default' => false,
),
'displayAuthor' => array(
'displayDate' => array(
'type' => 'boolean',
'default' => false,
),
'displayDate' => array(
'displayExcerpt' => array(
'type' => 'boolean',
'default' => false,
),
'excerptLength' => array(
'type' => 'number',
'default' => 55,
),
'feedURL' => array(
'type' => 'string',
'default' => '',
),
'itemsToShow' => array(
'type' => 'number',
'default' => 5,
),
),
'render_callback' => 'render_block_core_rss',
)
Expand Down