Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a function to replace the active theme's stylesheet with a different one (not just adding a new one, but actually replacing the current one)?

I'm developing a plugin, and using shortcodes (eg: [design style="dark"]) and I want this shortcode to remove the current stylesheet and apply a new one, along with new HTML for the page as well.

In fact, I want this shortcode to completely replace all of the source code for that specific post.

Can anybody point me in the right direction? Thanks in advance.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Main stylesheet of theme is surprisingly rigid concept. It is usually semi-hardcoded in header.php before any meaningful hooks and is very hard to change by code and reliably.

Since your context is actually wider and includes markup as well, you are better of hijacking template entirely, see template_redirect action for starters.

share|improve this answer
    
This is exactly what I was looking for, thank you very much. Once again you've helped me out. :) –  Jared Feb 21 '11 at 10:38

AFAIK there is no such function what you're asking for.

share|improve this answer

You might want to look at the Theme Switch and Preview plugin, uses shortcodes ([nkthemeswitch]).

share|improve this answer

Your Answer

 
discard

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.