WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've (I think) an interesting problem here. What I want to do is create a global archive page, with everything on it. Dates, authors, categories etc all on one page.

I have a child theme, with TwentyTwelve as the parent. Inside TwentyTwelve there exists archive.php, category.php, tag.php, author.php etc., basically all faceted archive templates split up individually.

In my child theme what I want to do is to create an archive.php template, and have that overwrite all of the parents templates.

I understand creating archive.php in the child will overwrite the parents archive.php, but before it checks for archive.php it will check for category.php, and use that template from TwentyTwelve before hitting archive.php in my child theme. Same for all other templates as per the template hierarchy.

I know of at least 2 ways to fix this:

  1. Delete category.php, tag.php etc from TwentyTwelve. (Not the best, as any update will restore those files)
  2. Re-create tag.php, category.php, etc in my child theme and copy/paste my layout for each one into each template file. (Better, but lots of template files just makes for a messy directory.)

I'm wondering if there is something I could drop in functions.php to overwrite the hierarchy, and force WP to use my child archive.php for all archive pages.


Regards, Dave

share|improve this question
up vote 1 down vote accepted

This is minimally tested-- nearly untested really-- but:

function force_archive_php_wpse_88824() {
  if (is_main_query() && is_archive()) {
    include (get_stylesheet_directory().'/archive.php');

You are interrupting the template load process and forcing a file of your choice to be used.


http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect http://codex.wordpress.org/Function_Reference/get_stylesheet_directory

share|improve this answer
Perfect. Thanks. :) – davebowker Feb 28 '13 at 15:32

Your Answer


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.