Santosh Kumar Santosh Kumar - 2 months ago 7
PHP Question

How to exclude posts that are categorized as "Tutorials" from RSS feed?

What I am doing is parsing RSS feed of a WordPress blog and getting information as

title
,
link
,
description
, and
pubDate
from the XML file.

<?php
$html = "";
$url = "http://www.ajneffects.com/blog/feed/";
$xml = simplexml_load_file($url);

for ($i = 0; $i < 5; $i++) {
$title = $xml->channel->item[$i]->title;
$link = $xml->channel->item[$i]->link;
$description = $xml->channel->item[$i]->description;
$pubDate = $xml->channel->item[$i]->pubDate;

$html .= "<a href='$link'><h3>$title</h3></a>";
$html .= "$description";
// $html .= "$pubDate";
}
echo $html;


Sorry for the bad markup, but that's it.

The thing is, I don't want to post tagged as "Tutorials" to show in the rendered HMTL file. I'm not sure how to get it done.

Answer

Try url like : http://www.ajneffects.com/blog/feed/?cat=-5 Here 5 is your "tutorials" category id

for more see: https://codex.wordpress.org/WordPress_Feeds

Comments