WordPress.org

Ready to get started?Download WordPress

Forums

using feeds in your blog (1 post)

  1. Ethan.Ellis
    Member
    Posted 6 years ago #

    Ok I got this code for a feed reader right. Now I want to use this on my blog so that I can other blog' posts on a certain page (not the whole site).

    <?php
    $DOM = new DOMDocument();
    $feedurl="<strong>http://feeds.feedburner.com/awesomerandomsite</strong>";
    $DOM->load($feedurl);
    
    $feed = $DOM->getElementsByTagName("item");
    $number = 0;
    foreach($feed as $feedvalue) {
      $feedtitles = $feedvalue->getElementsByTagName("title");
      $feedtitle  = $feedtitles->item(0)->nodeValue;
      $feedtexts = $feedvalue->getElementsByTagName("description");
      $feedtext  = $feedtexts->item(0)->nodeValue;
      $feedurls = $feedvalue->getElementsByTagName("link");
      $feedurl = $feedurls->item(0)->nodeValue;
      if($number<2){
        echo('<a href="'.$feedurl.'" ><h4>'.$feedtitle.'</h4></a><br />'.$feedtext."<br /><br />");
        $number++;
      }
    }
    ?>

    So I have that code but no way to use it on my blog can anyone help me. Remember I am ganna have more then one site connented throw the reader so the feed links will be anywhere from 5-20 and sould be able to be updated in the oder from which they have been posted.

    If anyone would there can tell me how to use this code and allow it to have many feeds while updating it in the order from which they have been posted then please help me.

    Thanks a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic