0

I am looking to create a mobile-only child theme for my site on a separate WordPress install but which is on the same server at the main install.

Example of folder Structure:

mysite

wp-content

Themes

parent-theme

tablet

wp-content

themes

child-theme

Would I have to duplicate the parent theme into the Tablet theme directory and repeat every time the parent theme is changed or is there a solution in which the child-theme can use the parent theme from the main install directory?

Note: WP Multisite is not an option due to all sites sharing the same database.

6
  • How are you going to find out if an incoming page request is from a mobile client?
    – cjbj
    Jan 31, 2017 at 11:52
  • Using WURLF, user agent detection. We already use this method in our current set up using individual themes for each install
    – James
    Jan 31, 2017 at 11:55
  • Yes, but are you detecting the device on the server level and then redirect to the appropriate WP-install, or are you detecting it in the WP-install and want to switch the theme there, if necessary?
    – cjbj
    Jan 31, 2017 at 12:03
  • It is detected on the server level and user is directed to wp-install, we have a different WP for Desktop, Mobile, Tablet
    – James
    Jan 31, 2017 at 12:04
  • In that case, I wouldn't know. Handing over to a different theme in the same installation might be easier. See this, for a slightly different problem: wordpress.stackexchange.com/questions/128504/…
    – cjbj
    Jan 31, 2017 at 12:13

1 Answer 1

0

Apparently what you want has been discussed for seven years now and still is waiting for a final solution.

However, since 4.7 there is the function get_parent_theme_file_path, which is called when a parent theme file is needed. This function has a filter which allows you to change the location. So, if you insert that filter into your child theme, you should be able to redirect all requests for a parent theme file to another WP installation altogether (if the security settings on the parent install allow outside calls to individual theme files).

I haven't actually tried this, but it should work.

2
  • This would have to be used for nearly every file though, would not a true 'child theme' imo.
    – James
    Jan 31, 2017 at 14:32
  • Yes, if you don't want your parent theme duplicated in the child install, every call to a parent theme file must be redirected like this. (personally I would just duplicate the parent theme to avoid complications)
    – cjbj
    Jan 31, 2017 at 14:37

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.