0

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

0

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' );
0

Today, wptuts posted an article about exactly this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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