1
I need to put in a landingpage that is in HTML the last posts of a blog that is in Wordpress, I got a code on the internet that brings the posts more I can not define how many posts will appear and nor take the image of the post. Someone can help me?
If you have any other code that does that too.
Thank you.
<?php
$url = 'http://blog.empresa.com.br/category/empresa/feed/';
$xml = simplexml_load_file($url);
$item = '1';
if($xml !== false){
echo '<div class="blog">';
foreach($xml->channel->item as $node){
printf('<h5><a href="%s">%s</a></h5>', $node->link, $node->title);
printf($node->description);
}
echo '</div>';
}?>
in this example you are loading the feed generated by worpress, one option is to configure it in wordpress. Another option is to manipulate this xml better to control the quantity in this loop.
– Guilherme