Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rarst/toolbar-theme-switcher
Adds WordPress toolbar menu that allows users to switch theme for themselves.
https://github.com/rarst/toolbar-theme-switcher
wordpress wordpress-plugin
Last synced: 2 months ago
JSON representation
Adds WordPress toolbar menu that allows users to switch theme for themselves.
- Host: GitHub
- URL: https://github.com/rarst/toolbar-theme-switcher
- Owner: Rarst
- License: mit
- Created: 2014-05-16T11:43:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-27T22:03:00.000Z (about 8 years ago)
- Last Synced: 2024-10-17T08:50:37.611Z (3 months ago)
- Topics: wordpress, wordpress-plugin
- Language: PHP
- Size: 33.2 KB
- Stars: 19
- Watchers: 5
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Toolbar Theme Switcher — for WordPress ##
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Rarst/toolbar-theme-switcher/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Rarst/toolbar-theme-switcher/?branch=master)Plugin provides toolbar (admin bar) menu to quickly switch between available themes.
Theme choice is individual for user, saved in cookies and doesn't affect current theme of the site.
Plugin is multisite-aware — it will only list themes allowed for site and save choice for each site separately.
## Installation ##
Download plugin archive from [releases section](https://github.com/Rarst/toolbar-theme-switcher/releases).
Or install in plugin directory via [Composer](https://getcomposer.org/):
composer create-project rarst/toolbar-theme-switcher --no-dev
## Frequently Asked Questions ##
### I switched to a broken theme!
You can reset via special URL parameter `example.com?tts_reset` or by clearing browser’s cookies for the site.
### I don't want all themes to show...
Filter `tts_allowed_themes` and unset unwanted themes.
Example code (removes Twenty Ten theme from the list):
```php
add_filter( 'tts_allowed_themes', 'hide_twenty_ten' );function hide_twenty_ten( $themes ) {
unset( $themes['Twenty Ten'] );
return $themes;
}
```### Who can see and use the menu?
Users with `switch_themes` capability (administrators by default).
Filter `tts_capability` (capability name) or `tts_can_switch_themes` (boolean) to customize.
### I don't want theme name in toolbar? | I want something else in toolbar?
Filter `tts_root_title` to control what it says.
### I have a lot of themes and it's becoming sluggish...
Plugin needs to build full list of available themes, which isn't typically needed on each page load and can be relatively slow with a lot of disk access.
When using Object Cache, caching theme data in WordPress can be enabled via:```php
add_filter( 'wp_cache_themes_persistently', '__return_true' );
```Since it doesn't handle invalidation (will need to wait or flush cache when themes are added/removed), plugin isn't enabling it and leaves choice up to the user.