Is it possible to allow users when logged in to switch the entire theme through a theme options panel? I don't want users to use the standard wordpress way, but instead just an option in their panel. Any ideas?

EDIT: This is for a user on their own network site.

  • Is this when they're editing their profile? – sanchothefat Nov 9 '11 at 17:56
  • This will be when they are logged in and if they are in the Theme Options Panel I've added. So not their profile section, but the theme options wptheming.com/2010/11/thematic-options-panel-v2. – JonnyPlow Nov 9 '11 at 18:16
  • Why don't you want to use the standard WordPress themes page? Seems like you're creating unnecessary work for yourself. – sanchothefat Nov 11 '11 at 12:35

If your theme has the theme-options built in then if people were to switch it the admin aspect of the theme would be lost if it wasn't in every theme so what I would do is to either:

  • Make the available themes for switching to into child themes of the one that has all the backend functionality.

You'd have to edit any themes you get to be child themes and do that every time you update them. Not much fun if these are themes you're grabbing from the repository or a 3rd party.


  • Make the theme-options page functionality into a plugin.

Regardless of the theme it will be available and you can just drop in any other themes you like without having to edit them.

In terms of code there are 2 filters you can use where the theme routing stems from. For child themes you only need to filter the stylesheet:

add_action( 'setup_theme', 'switch_user_theme' );
function switch_user_theme() {
    if ( false != ( $user_theme = get_user_meta( wp_get_current_user()->ID, 'theme', true ) ) ) {
         add_filter( 'template', create_function( '$t', 'return "' . $user_theme . '";' ) );
         add_filter( 'stylesheet', create_function( '$s', 'return "' . $user_theme . '";' ) );

NB. using the switch_theme() function updates the default theme for the whole site, not just the user.


Anything is possible!

Check this out: http://codex.wordpress.org/Function_Reference/switch_theme

Probably exactly what you're looking for.

This might also help: http://wordpress.org/extend/plugins/theme-switcher/

  • Unfortunately on looking at the function switch_theme() updates the theme for the site itself, so can't be used to display a different theme for an individual user. – sanchothefat Nov 10 '11 at 11:12
  • Switching in between child themes on a per user basis wouldn't be difficult. But switching entire site themes on a per user basis is not recommended. It would cause a slew of problems. – Sterling Hamilton Nov 10 '11 at 18:47
  • Maybe I should have explained that this is on a network. So I'm giving a user a network site, which would independently be using a different theme from the main site's theme. And on that network site they would be able to switch through the available themes. – JonnyPlow Nov 10 '11 at 20:40
  • Does this help? wordpress.org/extend/plugins/theme-switcher – Sterling Hamilton Nov 10 '11 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.