1
weiß jemand die beste Möglichkeit, einen RSS-Feed mit wp_rss zu kürzen? Ich habe versucht zu googeln und konnte nichts finden. Jede Hilfe wäre willkommen!How to truncate wp_rss
Hier ist mein Code:
<?php
include_once(ABSPATH . WPINC . '/rss.php');
$feed = 'http://miletich2.blogspot.co.uk/feed/';
$rss = fetch_feed($feed);
?>
<div class="container">
<div class="right">
<div class="rss-container">
<div class="rss-heading">
<?php
$title = "Clashing With Life";
$description = 'This is a blog written by an autistic person for other autistic people about <br>some of the biggest issues in life, whether deplorable or marvelous.';
echo '<h3 class="text-center">' . $title . '</h3>';
echo '<p class="">' . $description . '</p>';
?>
</div>
<div class="text-center">
<?php
if (!is_wp_error($rss)) :
$maxitems = $rss->get_item_quantity(3);
$rss_items = $rss->get_items(0, $maxitems);
if ($rss_items):
echo "<ul>\n";
foreach ($rss_items as $item) :
//instead of a bunch of string concatenation or echoes, I prefer the terseness of printf
//(http://php.net/manual/en/function.printf.php)
printf('<div class=""><li><a href="%s">%s</a><p>%s</p><p>%s</p></li></div>',$item->get_permalink(),$item->get_title(),$item->get_date(get_option('date_format')),$item->get_description());
'<hr>';
endforeach;
echo "</ul>\n";
endif;
endif;
?>
</div>
</div>
</div>
</div>
Du bist großartig! Vielen Dank! – avasssso