I'm using a static front page with my theme and it's convenient and just nice. I'd like to do the same for the category and author pages as well. I can't find this asked yet...

My reasons are...
• I don't want to mess with my theme beyond adding "require_once" to functions.php so that theme updates go smoothly (but I'll mangle the templates if I have too)
• I really like being able to edit the pages with the wordpress editor/media selector/etc

I'm guessing there must be some hook? I can't find it but there must be something I can set to point at a static page... right?

I am currently trying to understand if this will work - (resolve /author/ to a page or archive (of all authors) template)... If I find the answer first I'll put it here :)

Edit 1: Thanks to @Milo I learned about child themes. Better late than never...

I created a page author1. The url for the author page looks like author1.domain.com. There's a lot of 'nope's because I have no idea what I'm doing...


// check if this author has their own subdomain
// if so, pull a static page
if (is_sub_domain( $_SERVER['HTTP_HOST'] ) ) {

    // get author name from domain
    $author_name = substr(str_replace( my_main_domain(), '', $_SERVER['HTTP_HOST'] ),0,-1);

    // get the author page by name
    $include = get_pages('include='.get_page_by_title( $author_name )->ID);

    //nope - only post content, not header/title/formating/etc
    $content = apply_filters('the_content',$include[0]->post_content);
    echo $content;

    $page = $include[0]->guid ;

    //nope - white screen
    echo file_get_contents( $page);

    //nope - white screen
    include $page;

    //nope - white screen
    if ($stream = fopen($page, 'r')) {
        stream_get_contents($stream, -1);

Edit 2: tried changing the query.. still just a blank page


add_action( 'request', 'yoursite_request' );
function yoursite_request($query) {
    if ( domain.com/catagory/%catagory% ) {
        $catagory = %catagory%
        $query = new WP_Query( 'pagename' => $catagory );
    return $query;

Edit 3: I was just about to give up and start playing with Multisite when I found the solution! It may be bad form, destroy seo, or go against the intentions of the wordpress developers... but it is the answer to this question, which is all I was looking for. It's posted below for the next person who can't get a straight answer beyond "it's not possible" or "You're not supposed to do that".

  • 1
    This doesn't make much sense, the whole point of those are that they aren't pages, they're archives/listings. You can give them a custom design using the various theme templates ( e.g. archive.php category.php etc )
    – Tom J Nowell
    Commented Jan 6, 2015 at 16:53
  • It sounds like what you want to do is create some Theme Templates.
    – Howdy_McGee
    Commented Jan 6, 2015 at 16:58
  • @Howdy-McGee Yeah, I'm afraid so. Still, I'd prefer a static page so I can have a custom header/content WITH the loop added below and while still being able to easily update it at any time. Also, the more I alter my theme, the more I have to fix each time I update... which is sad :( Commented Jan 6, 2015 at 17:02
  • first, you should be using a child theme to keep things update-safe. the problem is the main query- it can't be a page and an archive at the same time. static front page is a special case that is hard-coded into WordPress, no other type of page can behave that way. you'll need additional queries inside of page templates to get what you want.
    – Milo
    Commented Jan 6, 2015 at 17:08
  • I just looked at the child theme that came with my theme... and it contains just functions-custom.php - I use my own custom_functions.php file already so I guess I use a child theme? Anyway, I know how to add queries... just not how to replace an archive with a static page. Commented Jan 6, 2015 at 17:18

1 Answer 1


The answer is essentially the same as my Edit 2 code. I must have had a typo the first time? I've tried to comment on what each thing does... The code works but the comments could be way off. I'm new at this. Also, this same code should work your author archive.

As one helpful person pointed out, this code is really useless and is not at all what Wordpress intended. However, with a static page you can use your theme templates to make a nice "category archive" and add the loop at the bottom of the page selecting to only show the correct category. Almost like having a whole new homepage for each topic you like to blog about!

// This works!
// right when you request the site this function is called
add_action( 'request', 'yoursite_request' );

function yoursite_request($query_vars) {

    // Do things to select %some-category% name here
    // www.domain.com/category/%some-category%

    // Do things to select the %category-archive%
    // %category-archive% = www.domain.com/category/%some-category%
    // Every time someone loads %category-archive% the static page will be called instead

    if ( %category-archive% ) {
        $category_name = %some-category%;

        // This changes the wp_query to a specific page (replacing the archive query)
        $query_vars = array( 'pagename' => $category_name );
    // returns the new query array back to wordpress...
    // leaving you with a static page for a category archive
    return $query_vars;

Also, if you use this code with the code in my last question/answer - how to use a different domain/subdomain for authors/catagories on single site? then you can get category/author sub/domains each with their own static page (and I think there is plenty of info, and even a plugin or two, for adding the loop to any page.. though I haven't looked yet)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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