Support » Fixing WordPress » RSS and PHP – Using category name

  • Greatings all,

    I am in yet another quandry. 🙁

    How do I go about getting the Category name in the <channel>/<title>

    So I would have <title>Brainfart central blog- Cat title here</title>

    I’v tried using <?php the_category_rss() ?> but that didn’t cut the mustard because it puts <category> in there also. I just want the category name. Is this possible using php?

    Once again any help would be much appreciated.


Viewing 1 replies (of 1 total)
  • This is a bit of code, but it duplicates the_category_rss() output without the tags (and adds a comma to separate multiple categories):

    $categories = get_the_category();
    $catsnum = count($categories);
    $hits = 0;
    $sep = ', ';
    foreach ($categories as $category) {
    echo convert_chars($category->cat_name);
    if($hits == $catsnum)
    $sep = '';
    echo $sep;
    } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘RSS and PHP – Using category name’ is closed to new replies.