{"id":323615,"date":"2026-06-09T08:11:48","date_gmt":"2026-06-09T08:11:48","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/4wp-style-switcher\/"},"modified":"2026-06-09T08:11:34","modified_gmt":"2026-06-09T08:11:34","slug":"4wp-style-switcher","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/4wp-style-switcher\/","author":17741300,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.1","stable_tag":"1.0.1","tested":"7.0","requires":"6.4","requires_php":"7.4","requires_plugins":null,"header_name":"4WP Style Switcher","header_author":"4wpdev","header_description":"Apply theme.json style variations per page; visitor style switcher and Light\/Dark menu toggle for FSE block themes.","assets_banners_color":"7b6bb6","last_updated":"2026-06-09 08:11:34","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/4wp.dev\/","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":22,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"4wpdev","date":"2026-06-09 08:11:34"}},"upgrade_notice":{"1.0.1":"<p>Review T1: Plugin URI points to 4wp.dev; removed Playground URL constant from plugin PHP (demo link remains in readme only).<\/p>","1.0.0":"<p>First WordPress.org release. Plugin Check fixes, readme trademark disclaimer, Playground blueprint v1.0.0.<\/p>","0.2.5":"<p>Performance: request-level caching for style resolution and theme.json variation lookups.<\/p>","0.2.4":"<p>Playground demo: per-page theme.json titles, Afternoon locked, Light\/Dark disabled when locked.<\/p>","0.2.3":"","0.2.1":"<p>Fixes style switching on WordPress Playground (HTTPS cookie + dynamic demo slugs).<\/p>","0.2.0":"<p>First feature release: visitor switcher, Light\/Dark navigation block, A\/B stats, and Playground demo.<\/p>"},"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3566286,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3566286,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3566286,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3566286,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{"blueprint.json":{"filename":"blueprint.json","revision":3566309,"resolution":false,"location":"assets","locale":"","contents":"{\"$schema\":\"https:\\\/\\\/playground.wordpress.net\\\/blueprint-schema.json\",\"meta\":{\"title\":\"Style Switcher \\u2014 4WP demo\",\"author\":\"4wpdev\",\"description\":\"Demo site: per-page theme.json styles, Light\\\/Dark menu toggle, floating switcher, A\\\/B testing. Twenty Twenty-Five.\",\"categories\":[\"plugins\",\"theme\",\"fse\"]},\"login\":true,\"landingPage\":\"\\\/\",\"preferredVersions\":{\"php\":\"8.2\",\"wp\":\"latest\"},\"features\":{\"networking\":true},\"steps\":[{\"step\":\"installPlugin\",\"pluginData\":{\"resource\":\"url\",\"url\":\"https:\\\/\\\/codeload.github.com\\\/4wpdev\\\/4wp-style-switcher\\\/zip\\\/refs\\\/tags\\\/v1.0.0\",\"caption\":\"Installing 4WP Style Switcher\"},\"options\":{\"activate\":true,\"targetFolderName\":\"4wp-style-switcher\"},\"ifAlreadyInstalled\":\"overwrite\"},{\"step\":\"installTheme\",\"themeData\":{\"resource\":\"wordpress.org\\\/themes\",\"slug\":\"twentytwentyfive\"},\"options\":{\"activate\":true}},{\"step\":\"runPHP\",\"code\":\"<?php require_once 'wordpress\\\/wp-load.php'; require_once ABSPATH . 'wp-admin\\\/includes\\\/plugin.php'; $bootstrap = null; foreach ( glob( WP_PLUGIN_DIR . '\\\/*\\\/4wp-style-switcher.php' ) ?: array() as $file ) { $bootstrap = $file; break; } if ( ! $bootstrap ) { return; } $plugin = plugin_basename( $bootstrap ); if ( ! is_plugin_active( $plugin ) ) { activate_plugin( $plugin ); } $dir = dirname( $bootstrap ); $setup = $dir . '\\\/playground\\\/setup.php'; if ( is_readable( $setup ) ) { require_once $setup; forwp_ss_playground_setup(); } ?>\"},{\"step\":\"installPlugin\",\"pluginData\":{\"resource\":\"wordpress.org\\\/plugins\",\"slug\":\"4wp-style-switcher\"},\"options\":{\"activate\":true}}]}"}},"all_blocks":{"forwp-style-switcher\/light-dark-toggle":{"$schema":"https:\/\/schemas.wp.org\/trunk\/block.json","apiVersion":3,"name":"forwp-style-switcher\/light-dark-toggle","title":"Light \/ Dark","category":"theme","parent":["core\/navigation"],"description":"Sun and moon toggle for Light\/Dark style variations in the navigation menu.","keywords":["light","dark","theme","style","navigation","menu"],"textdomain":"4wp-style-switcher","icon":"admin-customizer","supports":{"html":false,"reusable":false,"multiple":false,"interactivity":false,"spacing":{"margin":true,"padding":true}},"editorScript":"file:.\/editor.js","editorStyle":"file:.\/style.css","style":"file:.\/style.css","viewScript":"file:.\/view.js","render":"file:.\/render.php"}},"tagged_versions":["1.0.1"],"block_files":[],"assets_screenshots":[],"screenshots":{"1":"Settings \u2014 General tab (default variation, visitor switcher, Light\/Dark mapping).","2":"Settings \u2014 Variations tab (allowed style variations).","3":"Frontend \u2014 floating style switcher and menu Light\/Dark toggle on Twenty Twenty-Five."}},"plugin_section":[],"plugin_tags":[211323,173231,201618,253581,205718],"plugin_category":[],"plugin_contributors":[262731],"plugin_business_model":[],"class_list":["post-323615","plugin","type-plugin","status-publish","hentry","plugin_tags-block-theme","plugin_tags-dark-mode","plugin_tags-full-site-editing","plugin_tags-style-variations","plugin_tags-theme-json","plugin_contributors-4wpdev","plugin_committers-4wpdev"],"banners":{"banner":"https:\/\/ps.w.org\/4wp-style-switcher\/assets\/banner-772x250.png?rev=3566286","banner_2x":"https:\/\/ps.w.org\/4wp-style-switcher\/assets\/banner-1544x500.png?rev=3566286","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/4wp-style-switcher\/assets\/icon-128x128.png?rev=3566286","icon_2x":"https:\/\/ps.w.org\/4wp-style-switcher\/assets\/icon-256x256.png?rev=3566286","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>4WP Style Switcher reads <strong>style variations<\/strong> from the active block theme (<code>theme.json<\/code> and <code>\/styles\/*.json<\/code>).<\/p>\n\n<p>A plugin by <a href=\"https:\/\/4wp.dev\/\">4wp.dev<\/a>. <strong>4WP<\/strong> is our project brand; the letters \"WP\" appear only as part of that brand name, not as a reference to WordPress. This plugin is not affiliated with, endorsed, or sponsored by WordPress.<\/p>\n\n<p>Source code and releases: <a href=\"https:\/\/github.com\/4wpdev\/4wp-style-switcher\">github.com\/4wpdev\/4wp-style-switcher<\/a><\/p>\n\n<h4>Development<\/h4>\n\n<p>Human-readable PHP source is in the public GitHub repository above. The plugin ZIP includes <code>src\/<\/code> (PSR-4 autoload via <code>src\/Autoload.php<\/code> when <code>vendor\/<\/code> is absent). No npm build step \u2014 front-end scripts ship as plain JS in <code>assets\/<\/code>.<\/p>\n\n<p><strong>Live demo (WordPress Playground):<\/strong> https:\/\/playground.wordpress.net\/?blueprint-url=https:\/\/raw.githubusercontent.com\/4wpdev\/4wp-style-switcher\/v1.0.0\/.wordpress-org\/assets\/blueprints\/blueprint.json<\/p>\n\n<p>The demo site <strong>Style Switcher<\/strong> uses Twenty Twenty-Five: About, Morning, Afternoon, and Evening pages with per-page styles, A\/B light vs dark, a bottom-right visitor switcher, and Light\/Dark in the header and footer menus.<\/p>\n\n<p><strong>Page style (editor)<\/strong> \u2014 pick a variation for a page; optionally lock it so visitors cannot override it.<\/p>\n\n<p><strong>Frontend switcher<\/strong> \u2014 visitors choose from allowed variations; the choice is stored in localStorage and synced to a cookie for server-side rendering.<\/p>\n\n<p><strong>Light \/ Dark (navigation block)<\/strong> \u2014 add the Light\/Dark block inside Navigation; map two variations (sun\/moon icons).<\/p>\n\n<p><strong>A\/B testing<\/strong> \u2014 split new visitors between two variations; daily aggregate stats monitor the traffic split.<\/p>\n\n<h4>Privacy<\/h4>\n\n<p>When the visitor switcher or A\/B testing is enabled, the plugin may store the selected style variation in a browser cookie (<code>forwp_ss_style<\/code>) and in localStorage on the visitor device. No personal data is sent to third-party services. A\/B stats are aggregated counts stored in your WordPress database.<\/p>\n\n<h3>Blocks<\/h3>\n\n<p>This plugin provides 1 block.<\/p>\n\n<ul>\n<li><p><strong>Light \/ Dark<\/strong> \u2014 menu toggle between two mapped theme style variations (sun\/moon icons).<strong>Hooks (developers)<\/strong><\/p><\/li>\n<li><p><code>forwp_style_switcher_variations<\/code> \u2014 filter theme variation list.<\/p><\/li>\n<li><code>forwp_style_switcher_ab_assigned<\/code> \u2014 after A\/B cohort assignment.<\/li>\n<li><code>forwp_style_switcher_analytics_track<\/code> \u2014 analytics events.<\/li>\n<li><code>forwp_style_switcher_ab_assignment_enabled<\/code> \u2014 filter A\/B assignment.<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Upload and activate the plugin.<\/li>\n<li>Go to <strong>Settings \u2192 4WP Style Switcher<\/strong>.<\/li>\n<li>On <strong>Variations<\/strong>, check which style variations visitors may use.<\/li>\n<li>Under <strong>General<\/strong>, set the default variation and optional Light\/Dark mapping.<\/li>\n<li>Edit a page \u2192 <strong>Page style<\/strong> panel to assign or lock a variation.<\/li>\n<li>In the site editor, insert <strong>Light \/ Dark<\/strong> inside the <strong>Navigation<\/strong> block.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"which%20themes%20are%20supported%3F\"><h3>Which themes are supported?<\/h3><\/dt>\n<dd><p>Block themes (FSE) that ship style variations under the theme\u2019s <code>\/styles\/<\/code> directory.<\/p><\/dd>\n<dt id=\"where%20is%20the%20playground%20demo%20configured%3F\"><h3>Where is the Playground demo configured?<\/h3><\/dt>\n<dd><p>In the GitHub repository: <code>playground\/setup.php<\/code> and <code>.wordpress-org\/assets\/blueprints\/blueprint.json<\/code>.<\/p><\/dd>\n<dt id=\"does%20the%20floating%20switcher%20list%20every%20theme%20variation%3F\"><h3>Does the floating switcher list every theme variation?<\/h3><\/dt>\n<dd><p>It lists variations allowed on the <strong>Variations<\/strong> settings tab. The menu Light\/Dark block uses only the two variations mapped under <strong>General<\/strong>.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Plugin URI: https:\/\/4wp.dev\/ (GitHub link stays in readme Development section).<\/li>\n<li>Removed <code>FORWP_STYLE_SWITCHER_PLAYGROUND_URL<\/code> from plugin PHP; no remote URLs in runtime code.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>First WordPress.org release (1.0.0).<\/li>\n<li>Plugin Check: inline script moved to enqueued assets; security and naming fixes.<\/li>\n<li>readme.txt: 4WP trademark disclaimer, Development, Blocks, Privacy sections.<\/li>\n<li>Playground blueprint and demo links updated for v1.0.0.<\/li>\n<\/ul>\n\n<h4>0.2.5<\/h4>\n\n<ul>\n<li>Request-level caching in Style_Registry, Style_Resolver, and Style_Applicator (faster page loads).<\/li>\n<li>GitHub README banner; Playground blueprint and demo links updated for v0.2.5.<\/li>\n<\/ul>\n\n<h4>0.2.4<\/h4>\n\n<ul>\n<li>Playground demo pages use theme.json variation titles (single H1 from template, slug in content).<\/li>\n<li>Morning \/ Afternoon \/ Evening \/ Night pages with matching per-page styles; Afternoon locked.<\/li>\n<li>Light\/Dark menu toggle disabled when page style switching is locked.<\/li>\n<\/ul>\n\n<h4>0.2.3<\/h4>\n\n<ul>\n<li>Per-page style meta, A\/B light vs dark, visitor switcher bottom-right, two locked demo pages.<\/li>\n<li>Shared navigation in header and footer template parts.<\/li>\n<li>Fix Documentation tab accordion spacing in admin.<\/li>\n<\/ul>\n\n<h4>0.2.2<\/h4>\n\n<ul>\n<li>Apply visitor style from the query param on the same request (no redirect; works in Playground iframe).<\/li>\n<li>Clean the style query param from the URL after the page loads.<\/li>\n<\/ul>\n\n<h4>0.2.1<\/h4>\n\n<ul>\n<li>Fix visitor style switching on WordPress Playground (server-side cookie via query param).<\/li>\n<li>Playground setup resolves variation slugs from the active theme dynamically.<\/li>\n<li>Cookie sync uses Secure flag on HTTPS.<\/li>\n<\/ul>\n\n<h4>0.2.0<\/h4>\n\n<ul>\n<li>Style registry and resolver for theme.json variations.<\/li>\n<li>Admin settings (General, Variations, A\/B Testing) with REST API.<\/li>\n<li>Frontend floating switcher with localStorage and cookie sync.<\/li>\n<li>Light\/Dark Gutenberg block for the Navigation menu.<\/li>\n<li>A\/B testing with lightweight daily stats table.<\/li>\n<li>WordPress Playground blueprint (Morning \/ Afternoon \/ Midnight demo).<\/li>\n<li>Fixes: empty allowed-variations recovery, A\/B REST recursion, partial settings save.<\/li>\n<\/ul>\n\n<h4>0.1.0<\/h4>\n\n<ul>\n<li>Initial scaffold.<\/li>\n<\/ul>","raw_excerpt":"Apply theme.json style variations per page or let visitors switch styles on the frontend (FSE block themes).","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/323615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=323615"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/4wpdev"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=323615"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=323615"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=323615"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=323615"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=323615"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=323615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}