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!
—————-
<?php
include_once(ABSPATH.’wp-content/plugins/rss.php’); // path to include script
$feed = fetch_rss(‘https://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; ?>———–
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘a beginner's question – php does not work’ is closed to new replies.