1

I wish to organize the my themes directory a little more. Is it possible to move header.php and footer.php to a sub directory?

I guess it's done by hooking on to some action, but is it possible with just a config setting?

0

1 Answer 1

4

It is not possible to override header/footer via hooks in respective get_header()/get_header() functions.

However it is often overlooked that these function allow input and loading different headers.

For example get_header( 'nested/header' ); will look for header-nested/header.php in theme's folder. It's kind of a hack in regards to subdirectory use, but it works. :)

1
  • Well, it works, but I would need both a nested-header directory and a nested-footer directory. I guess I'll just leave the at the root then. A way to do it might be write a function of my own, that loads the files, and triggers the correct actions, but then I would need to maintain it manually for every update. Thanks for the answer! :)
    – ptf
    Commented Jan 8, 2015 at 7:34

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.