← WordPress

Ir buscar uma feed RSS

Lida 2201 vezes

Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

No Wordpress é muito fácil adicionar uma Feed RSS na Sidebar, tem um widget próprio que o faz sem dificuldades...

Mas, e se eu quiser colocar uma feed numa parte do theme? Alguém me consegue ajudar nisto?
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Código: (php) [Seleccione]
<?php
   
include_once(ABSPATH.WPINC.'/rss.php');
   
$feed fetch_rss('http://feeds.feedburner.com/LibertyTuga');
   
$items array_slice($feed->items04);
?>

Mudas o link e o 4 para o numero de posts que queres que apareça.
Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Obrigadão ;)
Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Mehh, não consigo... A página deixa de abrir...

Código: [Seleccione]
<?php
include_once(ABSPATH.WPINC.'/rss.php');
$feed fetch_rss('http://e-companhia.com/novidades/feed');
$items array_slice($feed-&gt;items05);
?>
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Tentar substituir o &gt por >
Offline

GhostMaster 
Membro
Mensagens 1374 Gostos 0
Feedback +10

Troféus totais: 26
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 1000 Posts

Mehh, não consigo... A página deixa de abrir...

Código: [Seleccione]
<?php
include_once(ABSPATH.WPINC.'/rss.php');
$feed fetch_rss('http://e-companhia.com/novidades/feed');
$items array_slice($feed-&gt;items05);
?>

julgo que deve ser porque está a fazer referencia a um ficheiro que não deves ter rss.php....
Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Pois, não tenho não :s No theme certo?
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Tens sim, vem com o WordPress.

<?php
include_once(ABSPATH.WPINC.'/rss.php');
$feed = fetch_rss('http://e-companhia.com/novidades/feed');
$items = array_slice($feed->items, 0, 5);
?>
Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Não dá em nada, não aparece nada.

Bem, esqueçam... Deve haver um plugin que o faça, se não também não é MUITO importante.
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Onde o estás a meter? Aqui dá perfeitamente...

Já tentaste com outro feed?
Offline

Luís Salvador 
Membro
Mensagens 2068 Gostos 37
Feedback +4

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Estava a colocar o index.php mas não aparece nada... O pior é que isto nem é para colocar num theme, seria numa "espécie de post" que faz parte do theme.