Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For a user with wiki-update permission only, I want to list their wiki articles in the author archive page. Currently, it comes back with "NOT FOUND Apologies, but ...".

I am using the Twenty-ten child theme and created a custom loop-wiki.php but now have a block about how to proceed. Any ideas? Anyone? I've searched and found similar type discussion but nothing stands out.

Thanks!

share|improve this question
    
Related question. –  kaiser Mar 9 at 12:35

1 Answer 1

Author archives default to searching for posts of the post type post. You could override this with wiki like so;

function __set_wiki_for_author( &$query )
{
    if ( $query->is_author )
        $query->set( 'post_type', 'wiki' );
    remove_action( 'pre_get_posts', '__set_wiki_for_author' ); // run once!
}
add_action( 'pre_get_posts', '__set_wiki_for_author' );

Drop it in your a plugin or your theme's functions.php (if the file doesn't exist, create it).

share|improve this answer
    
Thanks for the response, I'll give it a shot! –  Steadwell Mar 19 '11 at 4:42
    
Hey there TheDeadMedic, Tried your advice, it worked, all too well! Thank you immensely! Now, if I can insert a test to discern between wiki-editor vs post author, I'll be "cook'n with gas!" Thanks again for your expertise! –  Steadwell Apr 2 '11 at 17:12
    
Sorry, not sure what you mean - do you want to check if the author (or the current user) has a certain role or capability? –  TheDeadMedic Apr 4 '11 at 15:29
    
I think they want only the query to grab the original author and not the editors so if I create a wiki article then my author page shows that but if I edit another person wiki article then it does not show in my author page. although I always thought a wiki was public contribution and that no one owns it. –  xLRDxREVENGEx May 18 '11 at 5:32
    
@TheDeadMedic what do you mean when you say "run once"? In the remove_action( 'pre_get_posts', '__set_wiki_for_author' ); Thanks a lot!!! –  Philip Dec 10 '11 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.