Quantcast
Viewing all articles
Browse latest Browse all 8245

sxss on "How to use a theme inside a plugin directory?"

Hello wp community!

I try to write a little plugin for a mobile theme. The plugin should checks if the current users has a mobile device ( true == wp_is_mobile() ) and then uses a mobile-theme instead of the usual one.

1.
My first tought was to seperate the plugin and the theme, but this solution is not very user friendly. It's realy easy to overwrite the activated theme in case of a mobile device, but users had to download the plugin first, than the theme.

2.
Than i have tried to use use the template_redirect hook to include my theme file and use die() after that. It seems to work, but wordpress thinks i use the standard theme (twentyeleven) and loads this themes functions.php code into my mobile theme (include the css and skripts).

Has anyone an idea how to set a theme directory outside of the /wp-content/themes/ directory?

Here my two solutions: https://gist.github.com/sxss/a0b4c235d8dcfc8681e5

Thanks for your help!


Viewing all articles
Browse latest Browse all 8245

Trending Articles