How to add a custom URL placeholder to author archives?

I am working with a client who has a directory site that allows users to create accounts, then lists of items from the directory. Right now, whenever a user creates an account, she gets a profile URL like:

domain.com/member/%author%

Which is accomplished with a simple:

Read More
$wp_rewrite->author_base = 'member';

Now, I need to allow those users the ability to create a list, which should result in this kind of a URL structure:

domain.com/member/%author%/%list%

So far, I’m creating these lists as custom post types. All of the articles and Stack Exchange posts I see on WP_Rewrite don’t cover a URL rewrite like this. Is this possible? Do you have any pointers on how this could be done?

Related posts

Leave a Reply

3 comments

  1. Option 1

    I assume custom post type generate a URL something like this

    domain.com/%custom-post-type%/%list%

    So you could write it so it looks as… since the main URL doesn’t have author before custom type you would have to do this via a function since authors are dynamic

    RewriteRule ^members/%author%/(.*)$ domain.com/%custom-post-type%/$1
    

    This doesn’t specifically modify the custom post type URLs but you should be able to modify this to your need
    https://gist.github.com/4336843

    Option 2

    or possibly if URL like this below and the custom post type doesn’t change you should be able to implement this in .htaccess and it takes the author in to account when rewriting

    domain.com/members/%author%/%custom-post-type%/%list%

    RewriteRule ^members/(.*)/(.*)$ domain.com/members/$1/%custom-post-type%/$2
    

    This has a very good explanation on rewrite URL in general
    http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

    Option 3

    Also you can rewrite the entire custom post type URL if you are not using it anywhere else… because

    register_post_type(); accept 'rewrite' => array ($slug)

    more info

    http://shibashake.com/wordpress-theme/custom-post-type-permalinks

    http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2