This WordPress plugin allows site visitors to change the active style in the K2 theme.
This plugin is the equivalent of a theme switcher for styles applied to the K2 theme. It allows your visitors to re-skin your site from a list of K2 styles that you select.
The default K2 style to be applied to a given post or page can be specified using a parameter added to the URL, post or page meta data, or an overall site default.
Style selections made by the user are persistent for the duration of their visit and override default values, however they can be overridden using a URL parameter.
Screenshots
The K2 Style Switcher options panel (partial)
FAQ
Do I Need To Make Any Changes to K2?
No, the K2 Style Switcher is completely self contained, no changes are required to the K2 core files
What Is The Difference Between A Base Style And A Selectable Style?
Base styles are activated on the K2 admin panel, these styles are applied to the site in addition to either the default selectable style or one that the site visitor has chosen. Base styles are intended to be used to add any snippets of CSS that should be loaded in all cases, thus saving the administrator from having to add these CSS snippets to each of the selectable styles.
Selectable styles are activated on the K2 Style Switcher admin panel, these are the styles that the site visitors can choose from. The default selectable style chosen on the K2 Style Switcher admin panel is applied to the site before the site visitor chooses a different selectable style. Note that a K2 style cannot be both a base style and a selectable style at once. If it is chosen as a base style on the K2 admin panel then it will disappear from the K2 Style Switcher admin panel.
Why Can’t I See the K2 Style Switcher Menu Under ‘Appearance’ In The Admin Area?
If K2 is not the active theme then the plugin does not instantiate itself and will not appear in the administration area or on the site. Make sure that K2 is the active theme.
When a Style Is Specified Using a URL Parameter Is It Set As The Current Style For The Whole Site?
Yes. When the page loads the selected style is stored in the PHP session variables as if the user had selected it using the style picker.
When a Style Is Specified Using a Custom Field Is It Set As The Current Style For The Whole Site?
No. The style specified in the custom field will only be used for the post or page that the custom field is set for. The style for the rest of the site will be selected using the normal logic.
Why Isn’t XYZ Working?
The K2 Style Switcher relies on various options set by K2. For it to function correctly please make sure that the latest versions of K2 and WordPress are installed. If you are still having problems then you can ask questions, leave comments or find more information at the plugin’s homepage: K2 Style Switcher
I want to help with development of this Plugin!
The project is now hosted on github.com. Just fork the project and send me a pull request.
New to git?
ChangeLog
1.1.3
- Cleaned up plugin header and readme as part of take over from original plugin author.
1.1.2
- Added
languages
folder for l10n files
- Added German translation (de_DE), many thanks to Julian Manzel
- Confirmed compatibility against WordPress 2.8.5
1.1.1
- Added code to allow the current style to specified as a URL parameter, for example
http://example.com/?k2ss_target_style=style/style.css
- Added code to allow the default style for a page or post to be specified using a custom field called
k2ss_default_style
1.1.0
- Encapsulated plugin functionality in a class
- Consolidated plugin options into an array stored in a single option
- Cleaned up code to match WordPress Coding Standards
- Re-wrote admin panel code to use the new options mechanism introduced in WordPress 2.7
- Made all plugin messages translatable
- Added footer message to plugin admin panel stating the name of the plugin, the current version and the author’s name
- Re-wrote plugin activation hook to attempt to pull in existing options from current and previous versions of the plugin as well as removing redundant options
- Added call to load the plugin l10n / i18n text domain
- Removed plugin deactivation code to stop configuration options being removed when plugin is deactivated
- Added uninstall script to ensure that configuration options are removed when plugin is deleted
- Added plugin widget in a class based on the WP_Widget class introduced in WordPress 2.8
- Added option to hide specific elements of WordPress & K2 standard footers
- Prevented styles that are always selected from being added to the list of switchable styles
- Took out custom WPMU checks, detection of K2 styles directory and URL is now based on K2 options
- Added a message to the K2 options page explaining how styles are layered
- Added code to make sure that the plugin is not loaded if K2 is not active
1.0.0
- Initial version of plugin originally written by Kimya Hasira
- Added WPMU compatibility