Miscellaneous
Changing Theme on the Fly
The plugin supports the ability to change the theme “on the fly”. It is possible to change the theme only for entire page. Change theme only for one STB block is impossible.
To change the STB theme, you must replace the stylesheet and options of the current STB theme by stylesheet and options from another STB theme. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* Template Name: STB Pro Theme */ global $stbProObject, $stbTheme; // Getting the value of a custom field $stbTheme = get_post_custom_values('stb_theme'); // The substitution of stylesheet of the current theme add_filter("stb_pro_load_stylesheet", "change_stb_theme"); function change_stb_theme() { global $stbTheme; $theme = $stbTheme[0]; $dir = str_replace('_', '-', $theme); return get_option('siteurl') . '/wp-content/stb-pro-themes/'.$dir.'/stb-pro.css'; } // Replacement of the current theme options by the options of loading theme $stbProObject->setThemeOptions($stbTheme[0]); |
This example is demonstrating how to change the STB theme using the plugin’s filter and predefined value of custom field. Place this code as close to the beginning of the file, before the HTML tags and output functions.
Of course, you can use filter “stb_pro_load_stylesheet” for replacement STB theme at any suitable location of blog template, for example in the file functions.php. However, in this case, you have to set the conditions for the filter execution, depending of the currently loading site page.
Localization
STB Pro plugin uses the Separate Localization Model. This means that the plugin loads a different translation files for the Admin Side and the Front Side. This reduces the load on the server, because the translation file for the front side is significantly smaller than the file for the Admin Side.
If you want to localize this plugin, you have to do the translation both for the Admin Side and for the Front Side.
The translation files for the Front Side are located in the root folder of STB Pro plugin. The translation files for the Admin Side are located in the subfolder “langs” of STB Pro plugin.
© 2014, minimus. All rights reserved.