Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hoping someone can help.

I'm trying to update a friends website - the original developer has gone AWOL unfortunately and left me to pick up the pieces.

On the front end of the site the developer has installed Magpierss to have a twitter feed scroll along the bottom. However we've just noticed that in the blog section (powered by wordpress), they've actually hard coded the feed so it never updates.

I've tried editing the wordpress footer to reflect that of the one uses on the front-end as per below:

<div id="footer">
<div class="top_details">
  <div class="tweet" style="display:inline;">
    <div id="TICKER" style="overflow:hidden; display:inline;" onMouseOver="TICKER_PAUSED=true" onMouseOut="TICKER_PAUSED=false"><?=$rss_news_items ?></div>
  </div>
  <script language="javascript" src="common/js/webticker_lib.js" type="text/javascript"></script> 
  <div class="email_box">

And have updated functions.php with following:

    <?php
define('MAGPIE_DIR','magpierss');

require_once(MAGPIE_DIR.'/rss_fetch.php');

$url = 'http://twitter.com/statuses/user_timeline/421720094.rss';

$num_of_items = 10; //set  $num_of_items = 'All' to show all items;

if ( $url ) {
    $rss = fetch_rss( $url , 3600 ); //60 * 60 = 1 hour cache age
    $rss_feed_name =  $rss->channel['title'] . ' Updated: '. $rss->channel['lastbuilddate'] ;

    if($num_of_items=='All') $num_of_items = sizeof($rss->items);

    if(sizeof($rss->items) < $num_of_items)  $num_of_items = sizeof($rss->items);

    $rss_news_items = '';
    for ($i=0; $i < $num_of_items; $i++) {
        $href = $rss->items[$i]['link'];
        $title = $rss->items[$i]['title'];
        $description = $rss->items[$i]['description'];
        $date = $rss->items[$i]['pubdate'];

        $rss_news_items .= '&nbsp;&nbsp;<span class="linkTextOnly" style="display:inline;">&nbsp;<a href="'.$href.'" target="_blank" rel="no-follow">'.$description.'</a></span>&nbsp;';
    }

}

?>

I've uploaded the Magpierss folder to the site's theme folder but I keep getting an error in the wordpress footer saying that the directory doesn't exist.

I then thought I could just use the front end version and just call the same footer.php include file that the front end of the site is using from within wordpress' footer.php file. Again - this threw an error saying something about absolute urls' not being allowed.

If anyone could help it would be greatly appreciated - I'm still learning wordpress and am primarily a front-end developer rather than a PHP developer - so i'm feeling a bit out of my depth.

Thanks

share|improve this question

1 Answer 1

up vote 3 down vote accepted

My advice would be to scrap that.

Fetching RSS feeds is part of WordPress functionality. In the past it used Magpie (so no sense whatsoever in adding another copy) but it is long deprecated and currently SimplePie is used.

What this means in practice that there is fetch_feed() WordPress function that will completely handle feed retrieval and parsing. There are plenty of tutorials around on using it, starting with Codex that I linked to.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.