Forums

How to use is_author in feeds? (6 posts)

  1. pampfelimetten
    Member
    Posted 1 month ago #

    Hi dear community,

    I try to get the following to work:

    function xxx_filter_cat()
    {
    	if (is_author()) query_posts("cat=4");
    	if (is_front_page()) query_posts("cat=2,3");
    }
    
    add_action('rss2_head', 'xxx_filter_cat');

    It should alter the rss2 feed, depending if it should generated for the general homepage, or for a single user.

    But: It doesn't work at all - is_author and all the others is_* functions I tried always trigger false. is_feed works, but well, doesn't help me very much.

    So: How can I determine the request inside the rss feed?

    Thanks in advance!

  2. pampfelimetten
    Member
    Posted 3 weeks ago #

    nobody can help me?

  3. pampfelimetten
    Member
    Posted 3 weeks ago #

  4. t31os_
    Member
    Posted 3 weeks ago #

    is_author and is_XXX type functions (generally) check to see if there is a set query var..

    So author would be a query like.

    yoursite.com?author=pampfelimetten
    yourstei.com/author/pampfelimetten

    Depending on your permalink settings.

    http://codex.wordpress.org/Conditional_Tags#An_Author_Page

  5. pampfelimetten
    Member
    Posted 2 weeks ago #

    Hi t31os_

    thanks for your answer!

    The problem is: They do work at:
    yoursite.com/author/pampfelimetten

    but NOT at:

    yoursite.com/author/pampfelimetten/feed

    Which, in my humble opinion is a bug.

    I can alter nearly every part of wp, and I think I should be able to alter the feeds of authors, categories, etc... independent to each other.

  6. t31os_
    Member
    Posted 2 weeks ago #

    Is this on a test site or one i can see?

    If you're using a local install, print out your rewrite rules so you can check they exist..

    <pre><?php print_r( $wp_rewrite->rules ); ?></pre>

    localhost/author/admin/feed/ - works as expected for me..
    or
    localhost/author/testuser/feed/ - also works

    Perhaps you should try a pre_get_posts filter for managing the categories on feeds though..

Reply

You must log in to post.

About this Topic