Giter Site home page Giter Site logo

toolbar-theme-switcher's Introduction

Toolbar Theme Switcher — for WordPress

Toolbar Theme Switcher description pretty much fits in its name.

This plugin provides toolbar (previously known as admin bar) menu for users 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

Toolbar Theme Switcher is a Composer package and can be installed in plugin directory via:

composer create-project rarst/toolbar-theme-switcher --no-dev

Frequently Asked Questions

I switched to broken theme!

Clear the cookies. Don't do it again.

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):

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:

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.

Changelog

1.3

  • (enhancement) made plugin not interfere with Appearance admin page and real theme switching

1.2.1

  • (internal) updated theme allowed check to use native method over enumeration, improves boot performance

1.2

  • (internal) reworked to filter underlying options - more robust, should solve customizer issues and similar
  • (localization) made translation-ready, added russian translation
  • (compatibility) removed legacy checks, increased minimum required WordPress version to 3.4

1.1.4

  • (bugfix) fixed crash in installations with multiple theme directories

1.1.3

  • (docs) added example code for removing theme from list to readme
  • (bugfix) improved cookie name to better work on secure sites

1.1.2

  • (bugfix) changed order of function checks to prevent deprecated notices in admin

1.1.1

  • (bugfix) fixed fatal error on deprecated function in WP 3.4 #blamenacin
  • (internal) switched to older add_menu() method for now (pre-3.3 compatibility)

1.1

  • (internal) code cleanup
  • (enhancement) show current theme name in toolbar, props Leho Kraav
  • (enhancement) added filter for root node title, props Leho Kraav

1.0

  • Initial repository release.

toolbar-theme-switcher's People

Contributors

rarst avatar ryannutt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.