Theme Switcha

Omschrijving

Preview any theme privately on the front-end
Develop themes privately behind the scenes
Enable your visitors to switch themes

Er zijn veel thema switch plugins maar geen enkele levert de eenvoud, prestatie en betrouwbaarheid die ik wens voor mijn eigen sites. Dus schreef ik mijn eigen plugin door gebruik te maken van de WP API en hield de plugin zo gericht en solide mogelijk. Alleen essentiële thema switch mogelijkheden zijn toegevoegd tezamen met een eenvoudige doch informatieve gebruikersinterface (UI). Dit geeft een consistente en kwalitatieve thema switch ervaring die je eventueel kunt delen met je bezoekers.

Switch naar een alternatief thema voor voorvertoning of ontwikkeling terwijl bezoekers het standaard thema gebruiken 🙂

What it’s for..

Theme Switcha:

  • Enables visitors to switch themes via the frontend
  • Enables developers to build/customize themes privately
  • Enables you to create links that switch to specific themes
  • Enables live private previews of any installed theme

What it’s NOT for..

This plugin should not be used together with WordPress features such as Gutenberg Block Editor, Theme Customizer, Widgets, Menus, and other theme-related options. Doing so may result in private changes being made public on the current active theme. Learn more.

Plugin Mogelijkheden

  • Develop new themes while visitors use the default theme
  • Reguleer wie thema’s kan switchen (beheerders, gebruikers met een sleutel of iedereen)
  • Beheerders kunnen thema’s direct switchen via het WP Admin Gebied
  • Sta bezoekers toe om thema’s te switchen en te tonen in de front-end
  • Elke bezoeker kan zijn eigen thema kiezen
  • Zend voorbeeldlinks naar klanten middels de sleutel
  • Kies je aangepaste sleutel voor voorbeeldlinks
  • Zet de duur (cookie timeout) voor geswitchte thema’s
  • Activeer/inactiveer thema voorbeeld in het Admin Gebied
  • Activeer/inactiveer thema switchen zonder inactiveren van de plugin
  • Levert verschillende shortcodes om bezoekers thema’s te laten switchen
  • Shortcodes tonen thema’s als een lijst, selectiemenu of thumbnails
  • Gewijzigde opties worden opgeslagen terwijl er gewerkt wordt aan geswitchte thema’s
  • Dashboard widget to switch themes via select menu
  • Simpele en stijlvolle gebruikersinterface (UI) met schermafbeeldingen van elk thema
  • Werkt met elk thema, hoofdthema’s en child thema’s
  • Works with or without Gutenberg Block Editor
  • Works with WP Multisite

Thema Switcha maakt het mogelijk voor de sitebeheerder om nieuwe thema’s te ontwikkelen en te proberen zonder het standaard thema te wijzigen. Dus bezoekers blijven je site normaal gebruiken zonder te weten dat je nieuwe thema’s aan het testen bent achter de schermen. En als je je bezoekers de mogelijkheid wilt geven om thema’s te switchen, kun je dat ook doen door een shortcode toe te voegen aan elk WP Bericht of Pagina. In dat geval kan elke bezoeker een keuze maken uit je WordPress thema’s.

Kern Mogelijkheden

  • Gemakkelijk in gebruik
  • Bijzonder nette code
  • Eenvoudig en gericht
  • Gebouwd met de WordPress API
  • Licht, snel en flexibel
  • Gericht op prestatie en veiligheid
  • Regularly updated and “future proof”
  • Werkt geweldig met andere WordPress plugins
  • Plugin opties configureerbaar via instellingenscherm
  • Plugin ruimt zijn rommel op na inactievering
  • 1-klik herstel van plugin standaard opties

Plus you get free, responsive support from a top WP professional 😉

De Thema Switcha plugin is handig voor zaken als:

  • Onderhoudsmodus – toon een tijdelijk thema aan bezoekers terwijl je je hoofdthema bijwerkt
  • Thema testuitvoering – test en probeer nieuwe thema’s zonder verstoring in de frontend
  • Theme development – perfect for developing new theme templates to fit existing site content
  • Klantpresentaties – zend klanten speciale “thema voorbeeld” links om je nieuwe templates te tonen

I use Theme Switcha to develop new themes for my own sites like Perishable Press and Plugin Planet. The beauty of Theme Switcha is that visitors will never know that you are hard at work testing and building new themes behind the scenes 🙂

Privacy

This plugin does not collect or store any user data. It does not set any user cookies, and it does not connect to any third-party locations. Thus, this plugin does not affect user privacy in any way.

Bedankje

Thanks to Ryan Boren for the original Theme Switcher plugin.

Ondersteun ontwikkeling van deze plugin

I develop and maintain this free plugin with love for the WordPress community. To show support, you can make a donation or purchase one of my books:

En/of aankoop van 1 van mijn premium WordPress plugins:

Links, tweets en likes worden ook gewaardeerd. Bedankt! 🙂

Schermafdrukken

  • Plugin Instellingenscherm (toont de standaard opties)

Installatie

Getting Started

  1. Upload the plugin and activate
  2. Visit plugin settings and check the box to “Enable Switching”
  3. After clicking “Save Changes”, scroll down to view available themes
  4. Click on any theme thumbnail to switch privately to that theme

Important: Please read this support topic!

More info on installing WP plugins

Usage: Switch Themes

After activating Theme Switcha, visit the plugin settings page. There you can enable theme switching via the “Enable Switching” option. After that option is enabled, a menu of all available themes will be displayed on the settings page. From there you can click any thumbnail to switch privately to that theme. While you view the switched theme, your regular visitors will continue viewing your normal active theme. To verify this, visit your site in a different browser (with clean cache and cookies).

Tip: In the plugin settings, a thumbnail menu of all available themes will be displayed after you enable the “Enable Switching” option. Otherwise if that option is disabled, no theme thumbnails will be displayed.

Usage: Display Menus

In addition to switching themes via the settings page, you also can display a menu of switchable themes. In order for any theme-switch menu to work, the plugin setting “Allowed Users” must be set to “Everyone”. So all visitors can enjoy your site using their preferred theme.

Theme Switcha provides several shortcodes for displaying theme-switch menus:

Display themes as list of links:
[theme_switcha_list display="list"]
// display = (list or flat) format of the list

Display themes as thumbnail links:
[theme_switcha_thumbs style="true"]
// style = (true or false) include default CSS

Display themes in select/dropdown menu:
[theme_switcha_select text="Choose a theme.."]
// text = for the default option

Deze shortcodes kunnen in elk WP Bericht, Pagina of ondersteunend widget (b.v. de standaard “Tekst” widget die bij WordPress meegeleverd wordt) gebruikt worden.

Als je liever een thema lijst in je thema wilt opnemen, kun je de volgende template-tags gebruiken:

<?php if (function_exists('theme_switcha_display_list'))     theme_switcha_display_list(); ?>
<?php if (function_exists('theme_switcha_display_thumbs'))   theme_switcha_display_thumbs(); ?>
<?php if (function_exists('theme_switcha_display_dropdown')) theme_switcha_display_dropdown(); ?>

Als alternatief kun je shortcodes gebruiken in je thema-template door gebruik te maken van do_shortcode.

Usage: Theme-Switch Links

Theme Switcha also enables you to create theme-switch links that you can share with others. To begin, follow these steps:

  1. Determine the slug/name for the theme (should be same as name of theme directory)
  2. Choose any URL from your site, and append ?theme=mytheme

Bijvoorbeeld als je een thema hebt met de naam “Mijn Ongelooflijke Thema” die zich bevindt in een map genaamd /mijn-ongelooflijke-thema/, kun je een thema switchende URL op deze manier maken:

https://example.com/?theme=my-awesome-theme

What happens if you enter that URL in a browser? Well, that depends on the plugin setting, “Allowed Users”:

  • If Allowed Users is set to “Everyone”, the URL will enable anyone to switch to the specified theme
  • If Allowed Users is set to “Only Admin”, the URL will enable any logged-in admin-level user to switch to the specified theme
  • If Allowed Users is set to “Only with Passkey”, the URL requires a passkey in order to switch to the specified theme

We’ll look at how to make a Passkey Link in the next section. For the other two options, “Everyone” and “Only Admin”, you can either share the URL as-is, or make it a clickable hyperlink such as the following example:

<a href="https://example.com/?theme=my-awesome-theme">Switch to My Awesome Theme</a>

Usage: Passkey Links

Passkey links are a great way to enable private theme switching without giving the user access to the WP Admin Area. To make a Passkey Link, follow these steps:

  1. Bezoek de Thema Switcha instellingen pagina
  2. Enable the “Enable Switching” option
  3. For the “Allowed Users” option, select “Only with Passkey”
  4. Save changes

After saving changes, thumbnails will be displayed for each available theme. So to get a Passkey Link:

  1. Right-click on the thumbnail image for the desired theme
  2. Selecteer “Kopieer linkadres” om de URL naar je klembord te kopiëren

Done! You now have a Passkey Link ready to paste wherever. It will look similar to this:

https://example.com/?theme=my-awesome-theme&passkey=1234567890

So you can either share the Passkey Link as-is, or make it a clickable hyperlink such as the following example:

<a href="https://example.com/?theme=my-awesome-theme&passkey=1234567890">Switch to My Awesome Theme</a>

Here are some notes about Passkey Links:

  • Passkey links work for logged-in users and logged-out users
  • Passkey links must include the theme name and valid passkey
  • The theme name must be the theme slug (e.g., “my-theme” not “My Theme”)

Here is an example of proper passkey format:

https://example.com/?theme=THEMESLUG&passkey=PASSKEY

Here you would replace “THEMESLUG” with the slug of the theme you want to preview, and “PASSKEY” with the current passkey (provided via the “Passkey” setting). Here is an example showing how to make a clickable link from the Passkey URL:

<a href="https://example.com/?theme=THEMESLUG&passkey=PASSKEY">Switch Theme!</a>

Important

This plugin should not be used together with WordPress features such as Gutenberg Block Editor, Theme Customizer, Widgets, Menus, and other theme-related options. Doing so may result in private changes being made public on the current active theme. Learn more.

Plugin Options

Theme Switcha provides three basic configurations via the “Allowed Users” option:

  • Admins only – useful for theme developers to work on themes on a live site
  • Passkey only – useful for sending clients preview links to new templates
  • Everyone – allow everyone to switch themes (required for shortcodes)

Other options should be self-explanatory. If you have any questions, feel free to post in the Theme Switcha Support Forum. I usually respond very quickly 🙂

Note: It’s a good idea to change the Passkey periodically to prevent access to alternate themes (only required when using “Passkey only” configuration).

How It Works

If you’re still scratching your head at this point, here are some points that may help to clarify how theme-switching works:

  • Your site always will have a default active (primary) theme
  • The primary theme always will be visible to regular visitors
  • If you enable Theme Switcha, you can privately view other themes
  • So you can switch to a theme that only is active for YOU only
  • You can also enable visitors to switch themes on the front-end
  • You can even send a private theme-switch URL to friends, etc.

So while you re viewing and working on a switched theme, all other users will continue to see/use the default active theme. When you are done working on your switched theme, you can disable theme switching via the plugin settings. Upon doing so, you will be viewing the default active theme like everyone else.

Also keep in mind that theme-switching is browser-specific (via cookies). So if you need to view the theme in multiple browsers, the easiest way is to use the passkey link. The passkey enables you to quickly switch themes by simply entering the URL in your browser’s address bar. See the next section for details.

Because Theme Switcha is browser-specific, you can easily test theme-switching functionality by simply visiting your site in a different browser (with cleared cache and cookies). For example, in one browser you can be logged in to WordPress and switch to some other theme. While in the other browser, you are not logged in and thus viewing the site as a regular visitor, so you will be viewing the default active theme.

Going Live

Here are the steps to “go live” with your switched theme once you are ready to do so:

  1. Visit the plugin settings and disable the option “Enable Switching”.
  2. Visit Appearance > Themes to activate the theme for the world to see.

After these steps, the active theme will be visible to you and everyone else.

Thema’s Uitsluiten

Om een thema uit te sluiten van thema switchen open je het style.css bestand en voeg Status: private of Status: unpublished toe aan het begin van het bestand. Of om het thema alleen voor bezoekers uit te sluiten voeg Status: admin-only toe.

Hier is een overzicht:

Status: private     = theme excluded from theme switching
Status: unpublished = theme excluded from theme switching
Status: admin-only  = theme available for switching only by admin-level users
Status: publish     = theme available for switching by all users (depending on settings)
No Status header    = theme available for switching by all users (depending on settings)

Je kunt op elk moment de Status file toevoeging verwijderen om het thema beschikbaar te maken voor thema switchen.

Foutherstel

Als thema switchen voor je niet werkt dan zijn hier enkele zaken om te controleren:

  • Controleer of je meer dan 1 thema geïnstalleerd hebt
  • Make sure there are no other plugins interfering
  • Controleer of er geen .htaccess regels invloed uitoefenen
  • Controleer of er slechts 1 thema switch plugin geactiveerd is
  • Controleer of WP_DEFAULT_THEME niet gebruikt wordt in wp-config.php
  • Controleer of je thema de WP API gebruikt voor instellingen enz.
  • Probeer een andere browser en/of schoon je cache en cookies

Those are the main things to check. If theme-switching still isn’t working for your site, most likely something is interfering with normal functionality. In that case, you can do some basic troubleshooting to help identify the culprit.

Current active theme

Theme Switcha provides a function that returns the name of the currently active theme:

theme_switcha_active_theme()

This can be used just like any other WP function, in plugins and theme templates.

Inactiveren

Deze plugin ruimt de rommel zelf op. Alle plugin instellingen worden verwijderd uit je database als de plugin geïactiveerd wordt op het Plugins scherm.

Like the plugin?

If you like Theme Switcha, please take a moment to give a 5-star rating. It helps to keep development and support going strong. Thank you!

FAQ

Does the plugin enable anyone to switch themes (and not just logged in users)?

Yes, just set the “Allowed Users” option to “Everyone”, and then add any shortcode to your page.

I click the links but the theme does not switch?

Het zou kunnen zijn vanwege een caching plugin, of dat je probeert thema’s te switchen terwijl je uitgelogd bent van WP, het kan zijn dat de instelling “Toegestane Gebruikers” niet gezet is op “Iedereen”.

How do exclude themes from theme switching?

Open the theme’s style.css file and add Status: private or Status: unpublished to the file header. See section on “Excluding Themes” in the Installation Docs for more infos.

Does this plugin support Multisite?

It should work fine with Multisite, but it hasn’t been officially tested yet.

I am having problems with white screens or other errors?

Twee dingen: 1) inactiveer de plugin of verwijder via FTP, en 2) rapporteer het probleem opdat ik hem kan onderzoeken en proberen op te lossen.

How is the CSS included for the front-end shortcodes?

For better performance, the styles are included inline. The styles for each shortcode are minimal, so it’s faster to include them inline via style tags rather than chewing up another HTTP request. If you are concerned for whatever reason, you can use disable the styles in the [theme_switcha_thumbs] shortcode, like so: [theme_switcha_thumbs style="false"]. That way the styles won’t be included and you can add your own however desired.

Do I need to activate my alternate theme via Appearance > Themes?

Short answer: “no”, stay away from the Appearance > Themes screen while switching themes. Long answer: whenever you activate a theme via the Appearance > Themes screen in the WP Admin Area, that theme will be the one that is publicly displayed (live). That’s why, with Theme Switcha, you don’t make any changes via the Themes screen; rather, you just visit the plugin settings and click on whichever theme you want to view privately. Complete instructions are available here and in the plugin’s readme.txt.

Theme settings are not saved after theme switching is disabled?

As explained in the plugin documentation, Theme Switcha should not be used with admin-related functionality like Gutenberg, Customizer, Widgets, Menus, et al. You can learn more about this here.

Widgets are not saved after theme switching is disabled?

As explained in the plugin documentation, Theme Switcha should not be used with admin-related functionality like Gutenberg, Customizer, Widgets, Menus, et al. You can learn more about this here.

When I switch themes, will it apply to all admins or just me?

Great question. Theme-switching uses cookies to work, so it is browser-specific. That basically means that only the person who switched the theme will be able to view it. There currently is no option to switch to the same theme at the same time for multiple users. It is possible, however, to share the same Passkey Link to any group of users, so they all will switch to the same theme. For more information about this, check out the section “Usage: Passkey Links”, located in the Installation Docs.

How can I let visitors choose their own theme?

You can use any of the front-end shortcodes to enable visitors to select any available theme. It’s also possible to exclude themes from switching. Visit the Installation Docs for more information (under “Usage: Display Menus” and “Excluding Themes”, respectively).

When switching themes, will visitors still be able to see content from the database?

Yes, the same database/content will be displayed regardless of which theme is enabled or switched. The WP database provides the content for ALL themes.

How can I test demo content (like posts and pages) while switching themes?

Just make sure that all of the demo content is added as “Draft” or “Pending” instead of “Published”. Then only logged-in users with proper capabilities will be able to see it.

I still don’t get it.. how do I switch themes?

Here are the steps to use the plugin: 1) Visit the plugin settings and enable the setting, “Enable Switching”. 2) Under “Available Themes”, you will see all themes that are available for switching; click one to enable it only for you (admin). Whichever theme you enable via the plugin settings will be available to you only, so you can work on the theme while regular visitors see whichever theme is activated under the Appearance menu. Note that changes made to the switched theme will be visible only by you and other admins. Changes made to content (like post content, page content, categories, tags, et al), on the other hand, affect all themes and will be visible to your regular visitors. For more information, check out the Installation Docs.

If I want to permanently switch themes then I have to do it in the theme portion of the site and not the plugin. Right?

Correct. Theme Switcha is meant for temporarily switching themes. To actually change the current default active theme, visit the Themes page in the WordPress Admin Area.

I am assuming the switches made in your plugin takes effect for the world to see once the switch is made permanently. Right?

Yes this is correct for any changes made to the theme template files. So if you switch to “Awesome” theme using Theme Switcha, and then modify the theme template files, those changes will be made public once you change the default active theme to “Awesome” (via the WP Themes page).

But for any admin-related features like the Customizer, Widgets, Menus, and other theme-related options, any changes made to a switched theme may or may not be remembered after activating the theme as the site’s default active theme. This is why Theme Switcha is not recommended for use with admin features like Customizer, Widgets, et al. To learn more, read this Important Information.

Got a question?

Stuur je vragen of terugkoppeling via mijn contactformulier

Beoordelingen

9 september 2019
I use this plug-in for building multilingual sites with one template and one DB and one WordPress and without any pressure to site. Thanks God and thanks ThemeSwitcha.
29 juni 2019
This "Theme"-Switcher PlugIn works for me perfectly, if I need to change the webdesign completly to a new customer theme and the current WP WebCMS Installtion is productive with the old WP Theme! Only in the WP-Admin Area the new selected WP Theme is active/linked, great working experience!
24 maart 2019
Thank you very much for this plugin, it's really helpful while developing. This plugin is now part of my dev tools that I use every day! Thank you 🙂
29 januari 2019
It's okay if you want to view changes to your future theme in the customise option but when you go live, all of your work disappears and you have to start again from scratch. It does not do what it promises to do. Yes, you can view new themes before going live, but no, you cannot customise the theme and then keep the changes you made. Before using this, make sure you don't mind wasting a few hours of your precious time doing all of your hard work two or three times.
21 december 2018
Thought about creating a plugin like this. "Theme Switcha" handles all the things I thought of (and needed), but does them smarter 🙂 Thank you!
Lees alle 39 beoordelingen

Bijdragers & ontwikkelaars

“Theme Switcha” is open source software. De volgende personen hebben bijgedragen aan deze plugin.

Bijdragers

“Theme Switcha” is vertaald in 2 talen. Dank voor de vertalers voor hun bijdragen.

Vertaal “Theme Switcha” naar jouw taal.

Interesse in ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.

Changelog

If you like Theme Switcha, please take a moment to give a 5-star rating. It helps to keep development and support going strong. Thank you!

2.2 (2019/08/20)

  • Adds current theme infos to plugin settings page
  • Adds link to sticky post on plugin settings page
  • Revamps plugin documentation/readme.txt
  • Updates some links to https
  • Generates new default translation template
  • Tests on WordPress 5.3 (alpha)

2.1 (2019/05/01)

  • Bumps minimum PHP version to 5.6.20
  • Fixes bug with theme-switch menu in Toolbar
  • Updates default translation template
  • Tests on WordPress 5.2

2.0 (2019/03/10)

  • Adds check for admin user for settings shortcut link
  • Tweaks plugin settings screen UI
  • Generates new default translation template
  • Tests on WordPress 5.1 and 5.2 (alpha)

1.9 (2019/02/20)

  • Just a version bump for compat with WP 5.1
  • Full update coming soon 🙂

1.8 (2018/11/16)

  • Adds Dashboard widget (dropdown switcha)
  • Adds function to get current active theme
  • Adds homepage link to Plugins screen
  • Updates default translation template
  • Tests on WordPress 5.0 (beta)

1.7 (2018/08/20)

  • Improves support for WP Multisite
  • Changes theme query parameter to theme-switch
  • Adds rel="noopener noreferrer" to all blank-target links
  • Updates GDPR blurb and donate link
  • Further tests on WP 4.9 + 5.0 (alpha)

1.6 (2018/05/08)

  • Tweaks settings page UI
  • Adds “Theme Switcha” menu to the WP Toolbar
  • Adds filter hook, theme_switcha_styles_thumb
  • Adds filter hook, theme_switcha_styles_list
  • Fixes Undefined index notice in plugin-core.php on line 115
  • Removes unused font file, FontAwesome.otf
  • Generates new translation template
  • Updates plugin image files
  • Tests on WordPress 5.0 (alpha)

1.5 (2017/10/28)

  • Adds blurb for WP Themes In Depth! 🙂
  • Adds new default translation template
  • Tests on WordPress 4.9

1.4 (2017/08/01)

  • Updates GPL license blurb
  • Adds GPL license text file
  • Tests on WordPress 4.9 (alpha)

1.3 (2017/03/26)

  • Fixes not isset notice
  • Adds link to plugin docs
  • Adds some missing global variables
  • Tweaks styles of plugin settings page
  • Changes so themes are displayed only when switching is enabled
  • Fixes bug when two theme lists are displayed on the same page
  • Improves documentation on plugin usage
  • Fixes some incorrect translation domains
  • Replaces global $wp_version with get_bloginfo('version')
  • Generates new default translation template
  • Tests on WordPress version 4.8

1.2 (2016/11/18)

  • Voegt beoordeel deze plugin link toe aan instellingenpagina
  • Voegt &raquo; link op instellingenscherm toe om deze plugin te beoordelen
  • Verwijdert standaardstijlen voor abbr tag van de instellingenpagina
  • Cookies worden nu alleen met “HTTP Only” vlag verzonden (beveiligingsuitbreiding)
  • Regenereer standaard vertaaltemplate
  • Getest op WordPress versie 4.7 (bèta)

1.1 (2016/09/29)

  • Herstelt probleem: “can’t use method return value in write context”
  • Getest op WordPress 4.7 (alfa)

1.0 (2016/09/22)

  • Initiële uitgave