Different CSS style for logged in WordPress users

Update: I wrote a theme switch plugin that changes the template for logged in users. It's available here.

I like to tweak my wordpress theme. And I'm far too lazy to set up a second blog just for development. So I'm looking for a solution to work on my template without distracting visitors. I think one day I'll write an extension that is a little more powerful than this trick, but it's a start.

The easiest case is that you sometimes want to play around with your CSS styles. In this case, just add something like the following example to your template header. Put it where you include your CSS, and only logged in users will see your experimental CSS.


Of course, you can be more specific than showing any logged in user the testing style. Just compare the $user_ID with some specific ID.

2 comments

  1. avatar
    wrote this comment on

    Your plugin is great, I downloaded and use constantly, and this tip is also very cool, it would be great to have a plugin that already do this for us, but only to make the code really helps, thank you for your efforts in creating the plugin Theme Switch.

  2. avatar
    wrote this comment on

    God bless you.

Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.