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.

I have a site that will have some custom roles (capabilities), and I would like to have archives that list authors based on their role.

authors.php list the profile of one author, but there is no template for listing authors, right?

Is a custom template the only way to do this? I would rather not have empty pages that just serve as holders for my archives.

Thanks

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You may be able to abuse add_rewrite_endpoint for this purpose, depending on exactly what you want to do.

Some examples:

// add an endpoint
// http:domain.com/role/
// http:domain.com/role/foo/ 
function wpa_add_role_endpoint(){
    add_rewrite_endpoint( 'role', EP_ALL );
}
add_action( 'init', 'wpa_add_role_endpoint' );


// check if a role parameter exists, like:
// http:domain.com/role/foo/
function wpa_role_query( $query ){
    if( $query->get('role') ){
        echo $query->get('role'); // echoes 'foo'
        // modify the query $query->set( 'somevar', 'someval' );
    }
}
add_action( 'pre_get_posts', 'wpa_role_query' );


// check if role is in query vars array, like:
// http:domain.com/role/
function wpa_role_parse( $query ){
    if( array_key_exists( 'role', $query->query_vars ) )
        die('role query');
}
add_action( 'parse_request', 'wpa_role_parse' );
share|improve this answer
    
Thanks, I'll give this a try. –  coopersita Mar 19 '13 at 14:38
add comment

Today, wptuts posted an article about exactly this:

http://wp.tutsplus.com/?p=30564

share|improve this answer
1  
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  s_ha_dum Mar 19 '13 at 14:56
add comment

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.