Just noticed that the default RSS widget has stopped working on a few of my installs with the following error: RSS Error: WP HTTP Error: Operation timed out after 10 seconds…
I’ve tried increasing the timeout from 10 to 30 – didn’t work – it just takes longer and various other little things.
I am pretty sure it was working until I upgraded to 2.9 but can’t be sure – might be a server config issue I guess – but I’m not sure what I should be checking for – any suggestions?
]]><?php
require_once (ABSPATH . WPINC . '/rss.php');
wp_rss('https://alpha.libre.fm/rdf.php?fmt=rss&page=/user/bananabob/recent-tracks',5);
?>
And also tried
<?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
get_rss('https://alpha.libre.fm/rdf.php?fmt=rss&page=/user/bananabob/recent-tracks', $num = 5);
?>
as well as
<?php
require_once (ABSPATH . WPINC . '/rss-functions.php');
// here's where to insert the feed address
$rss = @fetch_rss('https://alpha.libre.fm/rdf.php?fmt=rss&page=/user/bananabob/recent-tracks');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<ul>
<?php
// here's (5) where to set the number of headlines
$rss->items = array_slice($rss->items, 0,105);
foreach ($rss->items as $item ) {
?>
<li>
<a href='<?php echo wp_filter_kses($item['link']); ?>'>
<?php echo wp_specialchars($item['title']); ?>
</a>
</li>
<?php } ?>
</ul>
<?php } ?>
None of which display anything in my blog.
Can someone help me solve this mystery.
<?php
include_once(ABSPATH . WPINC . '/rss.php');
wp_rss('https://www.thefreepokerroom.com/forum/rss3.php', 5);
?>
to include a rss on my wordpress site, it has worked before as far as I’ve seen but now I get the error message:
<b>Warning</b>: array_slice() [<a href='function.array-slice'>function.array-slice</a>]: The first argument should be an array in <b>/home/........./wp-includes/rss.php</b> on line <b>890</b>
The feed I’m using seems to validate on feedvalidator.org and it’s displayed correctly in the browser so I’m pretty sure it’s got something to do with wordpress.
It still works occasionally but when it does updating the page seems to break it again.
I saw a french guy in a french wordpress community that seems to have the same problem, however I don’t understand it the solution.
I noticed the problems today when I added banners to the pages but even removing the banners made no change.. And they are just simple links anyway.
Does anyone know why this problem happens and how to solve it? Any ideas are welcome.
]]>I am using the fetch_rss() native to WP to grab my twitter feed. However, the publish date comes through in a much longer format than I like. Does anyone know if there is a way to manipulate this parsed date using PHP, or is there a file I can alter?
The date comes in as part of an array $item['pubdate']
, and echos out as Tue, 30 Dec 2008 05:47:11 +0000
I like it to be more like, Dec 30 – 5:47.
Any help would be great!
PS. If you are wondering why I don’t use one of the great plugins already developed for twitter ~ I needed a plugin that supports an offset of posts, which none of them do. Fetch_rss() does.
Thanks everyone.
]]>$rss
object with all of the HTML stripped from the title
and description
elements in the $items
array. I have looked back through Trac and cannot figure out where or how this change came about. Does anyone have any insight, or know of a flag that can be set to re-enable full HTML output?
WordPress 2.6 Output:
[description] => <p><a href="https://www.flickr.com/people/stephenyeargin/">yearginsm</a> posted a photo:</p>
<p><a href="https://www.flickr.com/photos/stephenyeargin/3137553548/" title="Getting Into the Holiday Spirits"><img src="https://farm4.static.flickr.com/3225/3137553548_e60aacabee_m.jpg" width="240" height="180" alt="Getting Into the Holiday Spirits" /></a></p>
WordPress 2.7 Output:
[description] => pa href=https://www.flickr.com/people/stephenyeargin/yearginsm/a posted a photo:/p
pa href=https://www.flickr.com/photos/stephenyeargin/3137553548/ title=Getting Into the Holiday Spiritsimg src=https://farm4.static.flickr.com/3225/3137553548_e60aacabee_m.jpg width=240 height=180 alt=Getting Into the Holiday Spirits //a/p
Related Topic: https://www.ads-software.com/support/topic/228752
]]>include_once(ABSPATH . WPINC . '/rss.php');
function rss_fetching (){
global $wpdb;
$feeds_url = $wpdb->get_col("SELECT link_rss FROM $wpdb->links");
foreach ($feeds_url as $url){
$rss = fetch_rss($url);
$maxitems = 1; //Number of display items in each feed
$items = array_slice($rss->items, 0, $maxitems);
echo '<ul>';
if (empty($items)){
echo '<li>No items</li>';
} else {
foreach ( $items as $item ) {
echo "<li><a href=\"".$item['link']."\" title=\"".$item['description']."\">".$item['title']."</a></li>";
}
}
echo '</ul>';
}
}
First Q:
This code work exactly but decrease page loading speed! Fetching feeds repeat in each refresh. I know fetch_rss is related with MagpieRSS class. How I can use RSSCache of this class to remove fetching repeat?! Or maybe my code is wrong! because with one feed it
Work correctly and maybe used cash system of this class!
Second Q:
How I can get items date?
I’m having a difficult time using fetch_rss to access the content childNode:
Example:
XML:
<feed>
<title>title accessed fine</title>
<content type="xhtml">
<div xmlns="https://www.w3.org/1999/xhtml">
<p>this is the content I want to access</p>
</div>
</content>
</feed>
PHP:
normal function stuff…
// the below works for accessing the title node
$item['title'];
// and this DOESN'T work
$item['content']['div']['p'];
Note that the above is a highly stripped down version of what the feed actually looks like.
Am I incorrectly understanding the syntax construct?
Any help is greatly appreciated.
-Chris
]]>When I try to use the below code to get the 5 latest comments, I get this error :
Warning: array_slice() [function.array-slice]: The first argument should be an array in /home/site/www/wp-content/themes/default/sidebar.php on line 123
Code :
<li>
<h2>Last 5 Comments On </a></h2>
<?php
// Include the RSS functions of wordpress
include_once(ABSPATH . WPINC . '/rss.php');
// Grab my RSS feed
$feed = fetch_rss("<?php bloginfo('comments_rss2_url');>");
// I want 5 results please
$maxitems = 5;
$items = array_slice($feed->items, 0, $maxitems);
// Output the results!
if(!empty($items)) {
echo '<ul>';
foreach ($items as $item) {
echo '<li>';
echo '<a href="';
// This is a bit messy, but it makes the output valid XHTML strict by removing ampersands
$item['link'] = str_replace("&", "&", $item['link']);
$item['link'] = str_replace("&&", "&", $item['link']);
// End of messyness. Output the link
echo $item['link'];
echo '">';
// Output the title
echo $item['title'];
echo '</a>';
// If i've written a description, output it
if (isset($item['description'])) {
echo '<br />';
echo $item['description'];
}
echo '</li>';
}
echo '</ul>';
}
?>
The frustrating thing is : when I put another RSS feed into the fetch_rss location field, it works just fine.
Directly inputting the /sites/comment/feed address into the fetch_rss location field also does not work. Same error.
Going with Firefox to /site/comments/feed works just fine.
This happens whether or not I have the Feedburner FeedSmith plugin turned on.
As a side note, how can I reduce the number of characters returned to say, 50?
Thanks VERY much for your help on this, I really need assistance here.
Line 123 is BTW –
$items = array_slice($feed->items, 0, $maxitems);
Is there a way to throttle the fetch_rss() requests so that it staggers fetches?
[I’m using Yahoo Pipes as a temporary work-around, but it’s a pain]
]]><?php the_author_login(); ?>
in
<?php
require_once (ABSPATH . WPINC . ‘/rss-functions.php’);
// here’s where to insert the feed address
$rss = @fetch_rss(“https://example.com/author/<?php the_author_login(); ?>/feed/”);
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<?php
// here’s (5) where to set the number of headlines
$rss->items = array_slice($rss->items, 0, 5);
foreach ($rss->items as $item ) {
?>
‘>
<?php echo wp_specialchars($item[‘title’]); ?>
<?php } ?>
<?php } ?>
Just like the bolded text
Nothing shows up. Thanks
]]>