Hello folks,
I am trying to add a custom rss feed to my plugin.
To be clear, this feed will get information from a custom table. All the functions to extract the data from the table are there, but I don't understand how to produce an independent xml page using the powerful wp API.
My first attempt has been creating an independent php page with this content:
<?php
include('event_scheduler.php');
echo "<?xml version='1.0'?>";
?>
<rss version="0.91">
<channel>
<title>HTML.it News</title>
<link>http://webnews.html.it/</link>
<description>Le News di HTML.it sul mondo Hi-Tech</description>
<?php
$events = dbes_get_events(3);
foreach ($events as $event) {
echo "<item>";
echo "<title>$event->event_name</title>\n";
echo "<link>$event->event_url</link>\n ";
echo "<description>Blah Blah.</description>\n";
echo "</item>";
}
?>
</channel>
</rss>
</code>
<?php
?>
As you might have guessed, the dbes_get_events function queries my custom table.
The problem with my approach is that when trying to load this page I don't include the wp API, so the core functions of my plugin don't work.
What do you suggest? Is this the way to go, or should I implement my feed in another way?
Thanks in advance,
Davide