ThemeShaper Forums » Thematic

[closed]

Change number of external rss feeds depending on page

(1 post)
  • Started 4 years ago by dbetts
  • This topic is not resolved
  1. dbetts
    Member

    Is it possible to change the number of feeds which show from the same rss feed depending on which page you're on? For example I would like 2 feeds to show on my homepage (using feature site child theme) but would like 10 to show on a different page. I was wondering if this could be done with a 'else' 'if' statement in my functions php, but don't know php very well. Currently in my functions I have this, which is calling the two feeds for the homepage:

    function getFeed($feed_url) {

    $content = file_get_contents($feed_url);
    $x = new SimpleXmlElement($content);

    $count = '2';

    foreach($x->channel->item as $entry) {
    $original_date = $entry->pubDate;
    $pieces = explode(" ", $original_date);
    $new_date = date("l",strtotime($pieces[0])) . ", " . date("F",strtotime($pieces[2])) . " " . $pieces[1];

    echo
    "<span class='pubdate'>" . $new_date . "</span><span class'meta-sep'> | </span>" .
    " enclosure['url'] . "' title='Download $entry->title'>" .
    $entry->title .
    "
    ";
    if ($counter > 0) {
    return;
    }
    $counter = $counter + 1;
    }
    }

    Any help is appreciated.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.