Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]funkcja fetch_feed
morarz
post
Post #1





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 4.02.2011

Ostrzeżenie: (0%)
-----


Witam,

Kombinuje i kombinuje ale nie mogę przerobić skryptu tak żeby wyświetlał 5 różnych linków (u mnie to będą wiadomości ze strony)

  1. ?php if (function_exists('fetch_feed')) { ?>
  2.  
  3.  
  4. <?php include_once(ABSPATH . WPINC . '/feed.php');
  5.  
  6.  
  7.  
  8.  
  9. $feed = fetch_feed('http://www.wp.pl/rss.xml?id=1');
  10.  
  11. $limit = $feed->get_item_quantity(5);
  12.  
  13. $items = $feed->get_items(0, $limit);
  14.  
  15.  
  16.  
  17. if (!$items) {
  18.  
  19. echo "problem";
  20.  
  21. } else {
  22.  
  23.  
  24. foreach ($items as $item) { ?>
  25.  
  26. <?php }
  27.  
  28. } ?>
  29.  
  30. <?php } ?>


Daję kod na stronę :
  1. <h3><a href="<?php echo $item->get_permalink(); ?>"><?php echo truncateWords($item->get_title(),10),"..."; ?></a></h3><br clear="all">
  2. <a href="<?php echo $item->get_permalink(); ?>"><?php echo truncateWords($item->get_title(),10),"..."; ?></a><br clear="all">
  3. <a href="<?php echo $item->get_permalink(); ?>"><?php echo truncateWords($item->get_title(),10),"..."; ?></a><br clear="all">
  4. <a href="<?php echo $item->get_permalink(); ?>"><?php echo truncateWords($item->get_title(),10),"..."; ?></a><br clear="all">
  5. <a href="<?php echo $item->get_permalink(); ?>"><?php echo truncateWords($item->get_title(),10),"..."; ?></a><br clear="all">



Ale w morde kopane wyświetla pięć identycznych wiadomości!!
Jak to przerobic?
Z góry dzięki za odpowiedź.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 23:56