go41

SimplePie feed anywhere on your WordPress blog

von Joern am 28. Feb. 2009 | Keine Kommentare

to display any feed on whatever place in a wordpress site you can use SimplePie together with the WordPress plugin SimplePie Core
First step: get the plugin and the latest simplepie.inc, install and enable as explained on that sites. From there, you can go to the new Options – SimplePie for WP panel and configure your default settings.
Now the class simplepie should be available for use on any page, post, template, sidebar or footer of your blog.
Now, how to get it to display a feed?
I use on go41 in the footer something like this:

Code:

<?php   if (class_exists('SimplePie')) { ?>
<h3>Imported Feed Yahoo News Topstories</h3>
<?php $url = "http://rss.news.yahoo.com/rss/topstories";
$feed = new SimplePie($url); // setup the feed
$feed->set_cache_duration(86400); // 24hrs x 3600sec - 1day
$feed->set_timeout(5);
$success = $feed->init();
$feed->handle_content_type(); ?>
<?php if ($success): ?>
<?php foreach ($feed->get_items(0, 6) as $item):
if ($item) { ?>
<p><?php echo $item->get_title(); ?></p>
<p><?php echo substr(strip_tags($item->get_description()), 0 , 90); ?></p>
<?php } // end item ?>
<?php endforeach; ?><?php endif; //success ?><?php } // end Simplepie ?>

This code checks first if simplepie is enabled, then sets the feed url, the cache time and displays the feed if there is.

Feed entries are limited to 6 items and the content text is truncated after 90 characters.

Try it with any feed you can put as replacement for the yahoo feed, ask here if you get problems
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 73 weitere Ergebnisse dieses Threads:

wordpress sendet keine Email vom Host Europe Webpack

15. Mrz. 2010 (von: master)

Das Problem: Ein neues Wordpress Blog auf dem WebPack L 2.0 von Host Europe sendet einfach keine Emails. Angefangen hat das schon mit der ersten Mail, 'Neues WordPress-Blog', die nie ankam. Weiter ging's mit 'Registrierung eines neuen Benutzers' oder mails…

custom query loop with SELECT and pagination

17. Mrz. 2010 (von: Joern)

I have a custom template listing only posts of one category (category-XX.php)Here I am listing only events, future events and passed events. Using the plugin 'MR Event' I get the date of all events easily into a custom field.This list…

Changing the Background on the Arthemia Theme

19. Mrz. 2010 (von: karlisha12)

I am attempting to change the template background on my arthemia theme based website from black to white. I've changed the overall page background (from black to white) by simply changing the html code on the style sheet, however I…

HELP! WordPress Thumbnails Problem!

19. Mrz. 2010 (von: ckachelmuss)

Okay I would love help from anyone, but Joern you seem to be so active and good in this forum. Here is my issue, all of the sudden today my thumbnails stopped working. The only difference between the ones that…

Re: Changing the Background on the Arthemia Theme :: Reply by Joern

19. Mrz. 2010 (von: Joern)

I still do not really get what you want to do? You changed the grey borders #page from grey to #000000, black. White would be background:#FFFFFF;Changing the color around your theme to black:body {background:#000000;..tell me first, you want to change...…

Re: HELP! WordPress Thumbnails Problem! :: Reply by Joern

19. Mrz. 2010 (von: Joern)

I found one on your /page/4 - the Wordless Wednesday image IMG_6902.JPGputting just the image path into the browser (...timthumb.php?src=//wp-content/uploads/2010/0...) shows me two // in front of wp-content, should be one. Insert the path in customfield without /.Additionally it shows…

Re: HELP! WordPress Thumbnails Problem! :: Reply by ckachelmuss

19. Mrz. 2010 (von: ckachelmuss)

Thank you so much! I just switched to Wordpress 3 weeks ago and I am still learning. Are there any books you recommend on Wordpress or should I just rely on the Internet. Weiterlesen →

Re: HELP! WordPress Thumbnails Problem! :: Reply by Joern

19. Mrz. 2010 (von: Joern)

I never read books about that, google is faster! Wordpress is supported very well. On http://codex.wordpress.org you find best help, in my forum too ____________________you find me on Google+, Twitter and Facebook Weiterlesen →

custom rollover on category bar. Image instead of colour block.

19. Mrz. 2010 (von: chantel)

Hello joern,Please look at www.beautybuzzhk.com.I have extended my catagory bar to hold now 25 catagories. I wish to have an image when the mouse rolls over instead of the colour block. The image will be different for every catagory and…

Re: custom rollover on category bar. Image instead of colour block. :: Reply by Joern

19. Mrz. 2010 (von: Joern)

I need some time to test, might give you a complete solution with images you have to name according to your category slug, ie. day-spa.jpg, salons.jpg, antiaging.jpg, shop.jpg or pregnancy.jpgOr .gif, up to you. But gimme time, here the clocks…

Re: custom rollover on category bar. Image instead of colour block. :: Reply by Joern

21. Mrz. 2010 (von: Joern)

chantel, try this: first go to:http://themes.go41.de/should show you arthemia theme, now click:this category bar, is it about what you think?____________________you find me on Google+, Twitter and Facebook Weiterlesen →

Re: custom rollover on category bar. Image instead of colour block. :: Reply by Joern

21. Mrz. 2010 (von: Joern)

I explain now how to display an image on roll over with the mouse in Arthemia's category bar.BACKUP index.php and style.css FIRST !!I modified the category query in div id="middle" in some places, so you have to replace the full…

Add a YouTube user channel video to WordPress

23. Mrz. 2010 (von: master)

Any idea how to use the WordPress sidebar for streaming Youtube videos?It should update automatically with the latest video from my youtube channel and be automatically resized to fit a box of 300x250px.Here is how to do this for Youtube…

can you tidy up my coding?

26. Mrz. 2010 (von: chantel)

As you know i really dont know anything about programming, and you have been an enourmous help to me.You pointed out that my programming is really bad, thats because i just cut and paste and play around until things work.…

Adding an extra heading to the Featured section

26. Mrz. 2010 (von: sharonp)

Hi Joern,In a previous forum I had requested some help regarding adding an extra heading in the Featured section for the Arthemia free template. I would like it to look like the following:FeaturedPost...(with photo thumbnail)Post...(with photo thumbnail)SpotlightPost...(with photo thumbnail)Post...(with photo…

Re: Adding an extra heading to the Featured section :: Reply by Joern

26. Mrz. 2010 (von: Joern)

hi Sharon, thanks for asking here..what I explained you in the Arthemia forum was just how to change the Image (Featured)But I guessed you would like to show under this featured title some posts of your featured category and following…

Re: Adding an extra heading to the Featured section :: Reply by sharonp

27. Mrz. 2010 (von: sharonp)

Hi Joern,Yes, your sample is EXACTLY what I'm looking to do. I would like the "Spotlight" heading to be the exact same font as the "Featured" font, just like you have in your sample. If you can give me the…

Re: Adding an extra heading to the Featured section :: Reply by Joern

27. Mrz. 2010 (von: Joern)

Sharon, to get the image 'Spotlight' you see in the sample, just right click it and save somewhere on your PC. It has to go as 'spotlight2.png' into the folder /arthemia/images/ in your site. There should also be featured.png and…

Re: can you tidy up my coding? :: Reply by Joern

27. Mrz. 2010 (von: Joern)

Chantel, I started doing something, do you use in your dashboard under categories - description a <p> and </p> around the description? You should remove these paragraph formatting.The errors went downfrom 344 Errors, 180 warning(s)to 146 Er... Weiterlesen →

change index.php layout

28. Mrz. 2010 (von: msderky)

ok so i was over on arthemia forums and i noticed that you had solutions for all the questions i had...i literally bookmarked like 5 modifications that i want to do to my theme lol...anyhoo when searching i could not…

Re: change index.php layout :: Reply by Joern

29. Mrz. 2010 (von: Joern)

I am sorry to tell you that because the Arthemia Premium gets a member support only, I modify the free version only.I have no Premium on hand and it's much more difficult to 'override' settings set in the admin panel.Arthemia…

slideshow using jQuery cycle for WordPress (Arthemia)

29. Mrz. 2010 (von: Joern)

How to get a jQuery cycle slideshow of some posts into the Headline part or above frontlist I try to explain you here.A demo is available in the frontlist under the category bar here:http://themes.go41.de/?wptheme=arthemiaThis slideshow is using timthumb script which…

Re: change index.php layout :: Reply by msderky

29. Mrz. 2010 (von: msderky)

darn =( i must just download the free theme so that I am able to customize it myself. Thank you anywayz! Weiterlesen →

Re: Adding an extra heading to the Featured section :: Reply by sharonp

29. Mrz. 2010 (von: sharonp)

Thanks Joern. I'll give it a shot. Hopefully I won't mess things up Weiterlesen →

Re: slideshow using jQuery cycle for WordPress (Arthemia) :: Reply by cricrazy

29. Mrz. 2010 (von: cricrazy)

Joern,It looks great. Only one thing, I am trying is the get latest four posts in the slideshow, instead of particular category. We had done it before, can you help me with this? If I make it to work, I…

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: