I know how to query the users and create a list of authors and can accomplish this in a page template, much like is described here:
Authors Page : A page of authors
my question is then….
is there a way so that i can have www.site.com/author resolve to the page where I am displaying a list of all authors?
I just attempted to create a static page w/ an ‘author’ slug and it unsurprisingly 404s, I presume b/c WP is expecting something to follow ‘author’ and nothing is.
Do I create an endpoint (rewrite stuff is still complex for me) or can I intercept the template_redirection and send it to my custom page? Any push in the right direction would be most appreciated.
If you use code similar to setup the rewrite rules:
followed by code to add the
author_page
as a valid query var:You can then check for this in your
functions.php
, and callget_template_part
to call your ‘authors’ template and list the authors out, e.g.:Now all you need is an ‘authorlisting.php’ in your theme, and to flush your permalinks so the new rule takes effect. I wouldn’t add anything to the end of that rewrite rule however as it may interfere with the existing author rules, so be wary. Also you may have issues with pagination, but all I can say is to test it out.