nycmattw Posted June 27, 2010 Share Posted June 27, 2010 Is there a plugin that grabs the feed of your wordpress blog and pastes it on your webpage? Somewhat like what neowin has but just more compact like the mini spy. Link to comment Share on other sites More sharing options...
0 TechFreak:) Posted June 27, 2010 Share Posted June 27, 2010 You can use something simple like this: http://www.ajaxray.com/blog/2008/05/02/php-universal-feed-parser-lightweight-php-class-for-parsing-rss-and-atom-feeds/ For more complex parsing you can look for PHP classes such as http://simplepie.org/ Link to comment Share on other sites More sharing options...
0 Cupcakes Posted June 27, 2010 Share Posted June 27, 2010 Always remember that a Wordpress feed is no different than any other RSS feed. You can parse any RSS feed you want. So do you want a plugin that automatically fetches (with a cron job) an RSS feed and adds them as Wordpress posts? OR Are you asking to parse an RSS feed on a basic webpage? You sort of confused your question by asking for a plugin + Wordpress then ended it with a webpage. If you're using Wordpress, you can utilize WP-o-matic. However, if you do this, please ensure that you somehow give credit to the original source and/or if you can show only an excerpt. You don't want duplicate content on your site to negatively impact your SEO. Link to comment Share on other sites More sharing options...
0 nycmattw Posted June 27, 2010 Author Share Posted June 27, 2010 Well what I mean is that I want to get the titles of my latest blogs and have them in my What's new box in my website. http://lacydic.com Link to comment Share on other sites More sharing options...
0 Cupcakes Posted June 27, 2010 Share Posted June 27, 2010 Is your main website going to be powered off of Wordpress or is it just going to be a static website? If it's going to be powered off of Wordpress you can use the following: <?php query_posts('category_name=blog&showposts=5'); ?> <ul> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> Otherwise if it's going to be static, then you can try out some of the methods that was mentioned a couple posts ago. I do have a snippet you can use although beware it's 2 years old and may or may not be optimized/cause CPU issues, so if anyone wants to "make it better" by all means! Save as rssreader.php (or as something else but make sure you change the filename in the other snippet.) <?php function rssRequest($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $body = curl_exec($ch); curl_close($ch); return $body; } function RSS_Links($url, $size) { $feedObj = rssRequest($url); if(strstr($feedObj, "<?xml")) { $obj = simplexml_load_string($feedObj); $start = 0; $response = "<ul>"; foreach($obj->channel->item as $entry) { if($start != $size) { $entryURL = $entry->link; $entryTitle = $entry->title; $response .= "<li><a href=\"$entryURL\">$entryTitle</a></li>\n"; $start++; } } $response .= "</ul>"; } else { $response = "<ul> <li>No news found</li> </ul> "; } return $response; } ?> <?php $url = base64_decode($_GET['url']); if($url != "") { $returnBody = RSS_Links($url, 5); print($returnBody); } ?> And to call it: <?php $encodedRumors = base64_encode("RSS URL HERE"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "rssreader.php?url=$encodedRumors&clip=40"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $body = curl_exec($ch); curl_close($ch); print($body); ?> <?php } ?> PS - Scrolling text makes you site look very cheap... It was cool for geocities in 1998 but not for 2010. Static is best. Link to comment Share on other sites More sharing options...
0 nycmattw Posted June 27, 2010 Author Share Posted June 27, 2010 A static website is a website that hosted on my server right? Link to comment Share on other sites More sharing options...
0 Cupcakes Posted June 27, 2010 Share Posted June 27, 2010 No.. What I meant is that you'll just have static pages: eg index.html, about.html, etc. Wordpress would be a dynamic site. Link to comment Share on other sites More sharing options...
0 nycmattw Posted June 27, 2010 Author Share Posted June 27, 2010 Well that website is soon to be a dynamic website (if that means php). So is there a code for that? Or is it the same code. Link to comment Share on other sites More sharing options...
0 Cupcakes Posted June 27, 2010 Share Posted June 27, 2010 Changing the filetype from .html to .php doesn't change anything. If you're going to be creating each page separately, that's still static. Unless it's going to be handled by a CMS, then that's when it's dynamic. Stop focusing on whether or not it's static/dynamic. Has almost nothing to do with this and it's just confusing you. If you're going to use Wordpress, use the snippet I gave you for Wordpress. If you're not going to use Wordpress, use the snippet I gave you. I gave you BOTH options.. your question was answered already with exactly what to use. Now it's just up to you to read and pay attention to get the job done. Link to comment Share on other sites More sharing options...
0 RoomKid Posted June 28, 2010 Share Posted June 28, 2010 A custom webpage means a page that has not been generated by WordPress? Here's some working code that I grabbed from one of my old sites: <?php function getFeed($url) { $doc = new DOMDocument(); $doc->load($url); foreach($doc->getElementsByTagName('item') as $node) { $items[] = array( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'content' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => strtotime($node->getElementsByTagName('pubDate')->item(0)->nodeValue) ); } return $items; } $feed = getFeed('http://manmohanjit.com/feed'); echo '<ul>'; foreach($feed as $item) { echo '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'; } echo '</ul>'; ?> Link to comment Share on other sites More sharing options...
0 RoomKid Posted June 28, 2010 Share Posted June 28, 2010 If its on a WordPress template, use this WordPress ready function(but it may slow down your site) http://codex.wordpress.org/Function_Reference/fetch_feed Using Cupcake's WordPress method would be better. Link to comment Share on other sites More sharing options...
Question
nycmattw
Is there a plugin that grabs the feed of your wordpress blog and pastes it on your webpage? Somewhat like what neowin has but just more compact like the mini spy.
Link to comment
Share on other sites
10 answers to this question
Recommended Posts