[Resolved] a beginner's question – php does not work
The purpose is to display RSS (e.g. BBC news) content on a wordpress page. I have put the following code into the short code box and test it. It gave me a ‘Error 500’
Maybe it is the path wrong.
Thank you for your help!
include_once(ABSPATH.’wp-content/plugins/rss.php’); // path to include script
$feed = fetch_rss(‘http://feeds.bbci.co.uk/news/rss.xml’); // specify feed url
$items = array_slice($feed->items, 0, 7); // specify first and last item
<?php if (!empty($items)) : ?>
<?php foreach ($items as $item) : ?>
<h2>“><?php echo $item[‘title’]; ?></h2>
<p><?php echo $item[‘description’]; ?></p>
<?php endforeach; ?>
<?php endif; ?>
- The topic ‘[Resolved] a beginner's question – php does not work’ is closed to new replies.