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'd like to be able to set a wordpress theme for certain subdomains, but still load the same content for all installations.

For example, I have www.domain.com that loads the default template with default content. I'd also like to have mobile.domain.com, that too loads the same content but a separate template.

What would be the best way to go about this?

share|improve this question
Usually in this type of scenario the template is the same, but a different style sheet is loaded when a mobile browser is detected. If you want a plugin to take care of that, there are some good ones out there like WP Touch (commercial) or plenty of free ones too. – mike23 Jun 30 '11 at 16:50
We have a custom template made up, and I want the functionality to choose any kind of template based on the subdomain, not just limiting to mobile site design. Any idea? – Don Wilson Jul 11 '11 at 22:44

Without more detail about the kind of template you'd be serving up, the best I can advise is that you can use the 'template_redirect' hook to override the entire Template Hierarchy.

A more delicate way to do this would be by using on of the more specific filters. Each of the conditional get_*_template() functions in template-loader.php has a filter of its own which you can use to return your own template name. Look in includes/themes.php to see those filters.

Most of them end up using get_query_template(), which dynamically creates the filter name in a consistant way, but some of the others like author and category are separate - look around to find which if any suits you best under different circumstances.

share|improve this answer

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.