mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Fix xhtml output for RSS widget when feed contains no items. Fixed #4671 props brettz95 and Nazgul
git-svn-id: http://svn.automattic.com/wordpress/trunk@5968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f78592cf01
commit
36ec45d7ff
@ -966,10 +966,10 @@ function wp_widget_rss($args, $number = 1) {
|
|||||||
?>
|
?>
|
||||||
<?php echo $before_widget; ?>
|
<?php echo $before_widget; ?>
|
||||||
<?php $title ? print($before_title . $title . $after_title) : null; ?>
|
<?php $title ? print($before_title . $title . $after_title) : null; ?>
|
||||||
<ul>
|
|
||||||
<?php
|
<?php
|
||||||
if ( is_array( $rss->items ) ) {
|
if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
|
||||||
$rss->items = array_slice($rss->items, 0, $num_items);
|
$rss->items = array_slice($rss->items, 0, $num_items);
|
||||||
|
echo '<ul>';
|
||||||
foreach ($rss->items as $item ) {
|
foreach ($rss->items as $item ) {
|
||||||
while ( strstr($item['link'], 'http') != $item['link'] )
|
while ( strstr($item['link'], 'http') != $item['link'] )
|
||||||
$item['link'] = substr($item['link'], 1);
|
$item['link'] = substr($item['link'], 1);
|
||||||
@ -987,13 +987,12 @@ function wp_widget_rss($args, $number = 1) {
|
|||||||
}
|
}
|
||||||
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
|
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
|
||||||
}
|
}
|
||||||
|
echo '</ul>';
|
||||||
} else {
|
} else {
|
||||||
echo '<li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li>';
|
echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
</ul>
|
echo $after_widget;
|
||||||
<?php echo $after_widget; ?>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_widget_rss_control($number) {
|
function wp_widget_rss_control($number) {
|
||||||
|
Loading…
Reference in New Issue
Block a user