0

I have created a custom post type via plugin called landing-pages with a slug /landing/. I would like to assign a theme when the visitor visited a site with the slug /landing/ and when he visited a normal site should use the default theme.

Thanks

1

Setting theme dynamically is certainly possible, but not too convenient since it's hardly "normal" mode of operation.

In my experience this works best if you stay away from higher level template/stylesheet hooks and instead filter underlying options. In that way you can trick WP into thinking that configured theme is different from what it is and use it.

For a code example there are quite a few theme switchers around. You can take a look at Toolbar Theme Switcher plugin's code for one take on it (disclosure — I am its developer).

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.