简体   繁体   中英

Why would a Wordpress RSS feed description be limited to 346 characters?

Don't remember ever seeing this - and can't seem to find a similar question, so here goes...

I have a blog setup on WordPress. Works great. I'm pulling the RSS2 feed from it. Also works great. However, when I iterate over the output of the feed to style it for a page, I find the "description" node is being truncated to 346 characters, with " [...] " being added to the end.

I'm not doing that anywhere in my code. So I'm trying to find the reason why.

Here is a snippet showing the loop over the feed:

foreach ($rss->getElementsByTagName('item') as $node) {
    $item = array (
        'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
        'desc' => trim($node->getElementsByTagName('description')->item(0)->nodeValue),
        'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
        'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
        'postid' => $node->getElementsByTagName('guid')->item(0)->nodeValue,
        'category' => $node->getElementsByTagName('category')->item(0)->nodeValue
    );
    echo $node->getElementsByTagName('description')->item(0)->nodeValue;
    array_push($feed, $item);

The echo you see above outputs 346 characters only, and adds the " [...] " to the end.. like so:

Every day 22 million Americans suffer from uncomfortable acid reflux, according to the International Foundation of Functional Gastrointestinal Disorders. While many people may reach for medications like Proton Pump Inhibitors (PPIs) to provide relief from the effects of acid reflux, a new study from researchers at Kaiser Permanente may leave acid reflux sufferers reconsidering their […]

Yet.. when I look at what is actually coming from the feed, it shows the ENTIRE text of the post.. no limitations. (FYI.. I added the trim function to do just what you'd expect - to eliminate any beginning or ending spaces. When I removed it.. no difference.)

So.. anyone have an idea of what I'm missing?

TTAIA

Well

I think this plugin(RSS Just Better) helpful to you

you can manage easily

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM