I developed a website with blog using wordpress. After I had my theme ready the website owner asked me to use other theme which he bought only for the website’s blog.
How can I initialize this second theme without setting it as website theme on the options table?
I could do it defining the constant TEMPLATEPATH in wp-includes/default_constants.php
function 'wp_templating_constants':
define('TEMPLATEPATH', get_theme_root() . '/theme-name');
And setting filters for:
pre_option_template, template, pre_option_current_theme, stylesheet_directory_uri, stylesheet_directory in the functions.php of the theme.
But of course, I want to do it dynamically after knowing if the user is or is not on a blog page. Does anyone have any idea how to do it?
Here is the code for a plugin to set a theme to a list of categories which is not the theme defined on the database.
The parameters of the class are the theme name and an array of categories (ids, slugs or category objects).
Of course, this is what i need, probably for other themes it will be required other filters in the function ‘set_theme’.
It needs to be a plugin because plugins are loaded before the theme and even before WP class.
With this plugin the original plugin will never be called (at least on my case).