K2 Style Switcher

NB: The information on this page is automatically updated from WordPress.org, it may be up to 1 hour out of date.

Download

Download the current version of K2 Style Switcher – version 1.1.2 from the WordPress Plugin Repository. This version was released on Thu 5th Nov, 2009.

This plugin requires WordPress version 2.8 or later. It has been tested using WordPress version 2.8.5.

Description

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 overide default values, however they can be overidden using a URL parameter.

Changelog

Latest Change:

  • Added languages folder for l10n files
  • Added German translation (de_DE), many thanks to Julian Manzel
  • Confirmed compatibility against WordPress 2.8.5

For a complete list of changes to the plugin, view the Version History.

Plugin Stats

  • Last updated 126 days ago
  • More than 1,774 downloads
  • Rated 4 out 5 on average by WordPress.org users

Installation

For this plugin to work correctly the latest version of K2 must be installed and selected as the current theme

  1. Unzip the plugin archive
  2. Upload the entire k2-style-switcher directory to the /wp-content/plugins/ directory
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Goto the K2 admin panel ('Appearance' > 'K2 Options') and select the K2 styles that you ALWAYS want to be applied to the site (these are called the 'Base Styles' in our terminology)
  5. Goto the K2 Style Switcher admin panel ('Appearance' > 'K2 Style Switcher') and select the K2 styles that you want visitor to be able to choose from. You may also want to customise the other settings at this point
  6. To display the Style Picker that allows visitors to change the active K2 Style, either use the included widget or place the following code where you want it to appear: <?php k2ss_style_picker(); ?>. If the widget is used then the format of the Style Picker is set via the widget options, otherwise the default format set in the K2 Style Switcher admin panel is used

FAQs

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


Uninstallation

  • If you wish to stop using the plugin but keep your configuration options then simply use the 'Deactivate' link on the WordPress 'Manage Plugins' screen
  • If you wish to completely uninstall the plugin then use the 'Deactivate' link followed by the 'Delete' link on the WordPress 'Manage Plugins' screen. This removes the plugin files and your configuration options

Usage

This plugin includes a widget that displays either a dropdown menu or an unordered list of the available styles. The title of the widget and the type of menu to use are set in the widget options.

The other plugin options are set using the K2 Style Switcher administration panel ('Appearance' > 'K2 Style Switcher').

The style to apply to a given post or page is chosen using one of the following methods:

  1. A paramter can be appended to the page URL containing the relative path to the style, for example: http://example.com/?k2ss_target_style=style/style.css
  2. If a style has already been set in the PHP sessions variables then it will be applied to the post or page
  3. A custom field called k2ss_default_style can be added to the page or post. The field value should be set to the relative path to the style, for example: style/style.css
  4. If none of the above methods have set the style then the default style specified in the K2 Style Switcher administration panel is applied

Configuration

Default Style This option sets the K2 style that visitors will see upon first landing on your page unless another style has been specified using one of the methods described in the Usage section. Once they select a style, they will see that style instead.

Default Style Picker Format This option sets the type of style picker that will be displayed when the <?php k2ss_style_picker(); ?> function is called with no parameter set:

  • Unordered List - Displays a list of links
  • Dropdown Menu - Displays a dropdown menu

If you opt to use the unordered list when displaying the style picker you can style the link to the currently selected style using the .k2ss_selected class. For example: .k2ss_selected { border-left: 1px dashed #666; }

Footer Template This option sets the text that is displayed in your site footer. This is re-written each time the page is loaded, meaning that it always displays information relevant to the style that the visitor is currently seeing.

For a list of the available macros click the option name ('Footer Template') on the administration panel. This will display the list of macros and the information they will be replaced with at runtime.

Display WordPress footer This option controls the visibility of the standard WordPress footer ('Powered by WordPress and K2'). You may wish to hide this footer if you are placing the same information in the custom footer template.

Display feed links This option controls the visibility of the feed links footer ('Entries Feed and Comments Feed'). You may wish to hide this footer if you are placing the same information in the custom footer template.

Display base styles footer This option controls the visibility of the active styles K2 footer ('Styled with by '). You probably wish to hide this footer as any base styles that are active will probably be tweaks that do not need crediting.

Display page stats This option controls the visibility of the WordPress page loading stats footer (' queries. seconds.'). You may wish to show this information, it will appear just above the output of the custom footer template.

Available Styles This option displays all the styles currently available in your K2 styles directory. Select the styles you want visitors to be able to use. Note that styles are only shown here if they are not currently in use by K2.

Any styles that are set as active on the K2 options screen will be used as base styles. This means they will be applied in addition to either the default K2 Style Switcher style or the style that the visitor has chosen. This allows any custom CSS snippets to be maintained in one place rather than being added to each style.

Release Notes

  • No known issues are present in this version

News

To be informed of any news for this plugin, please subscribe it’s news feed. This only contains posts relating to this plugin. Alternatively please see the category archive.

Feedback

K2 Style Switcher is tested against a set of use-cases covering normal operation against the current version of WordPress. It has not been specifically tested for compatibility with any other WordPress Plugins. Feedback, bug reports and feature requests are very welcome, either by email or using the comments form at the bottom of this page.

Useful Links

20 Responses to “K2 Style Switcher”


  • hi. Thanks for plugin

    perfect.

    regards

  • Nice switcher, keep up the good work!
    Are you planning on working on a version that would switch the theme / style depending on the hour of the day (such as a Day and night theme)?

  • This is a very handy plugin.

    There is a great potential here to provide an alternative to Themes Switching, that is both efficient and more elegant.

  • I tried your switcher with standard widget manager in a text box to initiate the drop down. Nothing. If I switch over to K2 widget manager it works but the other widgets do not. How can I get this to work in the regular WP widgets? (I don’t want to edit *any* php code to maintain upgradability and flexibility. All changes must be in a plugin or widget.) thanks!!

  • doesnt work in my wordpress 2.7 :( , i have the 0.5 switch theme but not the yours

    • Hi mackzter, I have visited your site, and as far as I can see it isn’t running the K2 theme, which is the only theme this plugin is intended for. If you are running K2 then please let me know and we’ll working on solving any problems you may be having with the plugin.

  • I have a question. Is it possible to include the style parameter in a link?
    I want to make from another webpage to the blog the style switcher is installed at and i want to decide what style the poeple see when they use the link.

    Is that possible?

    thx

  • Hi Hugh! I’ve recently updated my wordpress blog to v2.8.5 and the K2 Style Switcher plugin don’t seems to work with the new wordpress release. :( I hope you update this wonderful plugin very soon. Thank you.

    • Hi Joshua, I have tested to the plugin with the latest version of K2 and WordPress 2.8.5 and it seems to work correctly. Could you give me a few more details of the problems you are having?

      Thanks,

      Hugh

      • The K2 Style Switcher Menu Under ‘Appearance’ In The Admin Area won’t appear.

        I also tried using the “” with a daikos text widget but nothing appears on the sidebar. Other widgets below it would disappear.

        • Hi Joshua,

          The scenario you describe would occur if the plugin detected that the K2 theme was not active, leading to two questions:

          1. Is the K2 theme installed and active when you are trying to use the plugin?
          2. What is the name of the folder that the K2 theme is stored in?

          The plugin uses get_current_theme(); to check if K2 is installed and active, so if you’ve installed K2 in a non-standard directory then it would not be detected. K2 should be installed directly into the ‘themes‘ directory (e.g. ‘/themes/k2‘), meaning that the K2 folders (app, blocks, css etc.) and files (404.php, attachment.php, comments.php etc.) should be directly inside this directory (e.g. ‘/themes/k2/404.php‘ etc.)

          Is K2 installed in this way for your site?

          Thanks,

          Hugh

  • Hello Hugh,

    I try to activate your plugin in my WP 2.8.5 but it doesn’t works. I got this error message :
    “Plugin could not be activated because it triggered a fatal error.

    Fatal error: Class k2ss_widget: Cannot inherit from undefined class wp_widget in /homepages/7/d250166249/htdocs/wp-content/plugins/k2-style-switcher/k2-style-switcher.php on line 838″

    Must i modify something on the k2-style-switcher.php page (line 838) ?

    Thanks by advance for your help.
    Regards,

    • Hi Jamesmith,

      If your running an unmodified version of WordPress 2.8.5 then it’s hard to see why you’d encounter this error. Basically it’s telling you that my widget class is trying to inherit from a built in WordPress widget class that was introduced in WordPress 2.8, but that the class could not be found.

      Are you running any other plugins, or have you modified the WordPress source code at all? Also, which theme are you running.

      Regards,

      Hugh

      • Dear Hugh,

        I installed a new Wordpress 2.8.5 with new database, because i had too much bugs, probably caused by other plugins.
        Now, in my new version i activated k2 switcher but nothing appear in admin panel “Appearence”, and no new widget listed.
        I use a personnal theme made on Artisteer 2.

        Regards.

        • Hi Jamesmith,

          This plugin is only designed to work with either the K2 theme (http://getk2.com) or a child theme based on K2.

          If the currently active theme on your site does not fit in either of these categories then the plugin will not instantiate itself, you will see no options panel, and no widget will appear.

          Regards,

          Hugh

Leave a Reply

Anti-Spam Protection by WP-SpamFree




Copyright © 2007-2009 Hugh Johnson

Site last updated Fri 6th Nov, 2009 @ 17:29; This content last updated Fri 6th Nov, 2009 @ 14:32