') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - EssentialBlocks/toggle-content: Content Toggle Block for Gutenberg · GitHub
Skip to content

Repository files navigation

Toggle Content

Contributors: wpdevteam, re_enter_rupok, Asif2BD, rahat89, RahatSheikhLeon Tags: gutenberg, block, blocks, editor, toggle, toggle content, content toggle, content switch, switch block, gutenberg blocks Requires at least: 6.0 Tested up to: 7.1 Requires PHP: 7.4 Stable tag: 1.3.0 License: GPLv2 or later License URI:http://www.gnu.org/licenses/gpl-2.0.html

Toggle Content block for Gutenberg to switch content or blocks with a beautiful switcher.

Description

Content Toggle will let you showcase your key content in an interactive way to attract visitors instantly. Using this Toggle Content plugin, you can use this feature within the Gutenberg Editor.

It’s super easy to use and support nested blocks within the content area. You can also switch blocks view with an easy and beautiful switcher.

Completely Customizable: You can customize Toggle Content just the way you want.

Super Light-weight: No extra resources used and it's highly optimized for super fast loading & instant Live editing.

Dedicated Support: We’ve an extraordinary support team ready to help you. Ask your questions in the support forum, we’ll get back to you immediately.

🚀 BACKED BY A TRUSTED TEAM

This Block is brought to you by WPDeveloper, the team behind the most popular elements library Essential Addons for Elementor (used by almost 1 million+ happy users from 180+ countries).

👨‍💻 DOCUMENTATION AND SUPPORT

  • For documentation and tutorials go to our documentation
  • To report issue and contribution visit Github.
  • If you have any more questions, visit our support on the Plugin's Forum.
  • For more information about features, FAQs and documentation, check out our website at WPDeveloper.

🙌 JOIN THE COMMUNITY

🎦 Subscribe to our Youtube Channel to watch video tutorials on WordPress.

🤝 Join our Facebook Community & get connected with expert web creators like yourself.

🧡 LOVED Toggle Content? Rate us on WordPress Repository

🔥 GET FREEBIES FOR YOUR WORDPRESS SITE

Consider checking out our other WordPress solutions & boost your WordPress website:

🔝 Essential Addons For Elementor: Most popular Elementor addons with 70+ widgets & ready blocks

Templately: Free templates library for Elementor & Gutenberg along with the cloud collaboration for WordPress

🔔 NotificationX: Best Social Proof & FOMO Marketing Solution to increase conversion rates

📚 BetterDocs: Best Documentation & Knowledge Base Plugin for WordPress reduce manual support tickets & improve user experience.

WP Scheduled Posts: Advanced editorial calendar & complete solution for WordPress Post Scheduling, social sharing, missed scheduled alerts and more.

ReviewX: WooCommerce Product review plugin that allows users to submit product reviews with multiple criteria, photos, video and more

Flexia: Most lightweight, customizable & multi purpose theme for WordPress

Visit WPDeveloper to learn more about how to do better in WordPress with Help Tutorial, Tips & Tricks.

Installation

Modern Way:

  1. Go to the WordPress Block/Gutenberg Editor
  2. Search For "Toggle Content".
  3. Install in 1-click

Old Way:

  1. Upload toggle-content to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Follow the Documentation

Frequently Asked Questions

Does it work with any WordPress theme?

Yes, it will work with any standard WordPress theme.

Screenshots

Changelog

1.3.0 - 25/08/2026

  • Fixed: PHP 8.0 - 8.5 compatibility issues
  • Fixed: WordPress version detection
  • Fixed: PHP 7.x compatibility
  • Fixed: Asset loading issues on newer WordPress versions
  • Improved: Asset loading and overall stability
  • Tested up to WordPress 7.1

1.2.8 - 16/04/2024

  • Fixed: compatibility support with wordpress 6.5 version
  • Improved: controls

1.2.7 - 02/04/2023

  • Improved: font loader and Controls
  • Added: core group block as a inner block

1.2.6 - 4/12/2022

  • Improved: update congrols

1.2.5 - 9/11/2022

  • Fixed: compatibility issue with WordPress 6.1

1.2.4 - 25/08/2022

  • Improved: update controls

1.2.3 - 03/08/2022

  • Improved: Style handler for reusable block
  • Improved: update controls

1.2.2 - 21/06/2022

  • Added: Animation, Custom Css and Responsive Options
  • Improved: Converted style-handler to php for working perfectly with Reusable blocks and FSE
  • Improved: Controls & structure

1.2.1 - 13/02/2022

  • Fixed: Frontend js file not enqueued

1.2.0 - 13-02-2022

  • Added: Block description in block.json file
  • Added: Support for full site editing & wp5.9
  • Added: Responsive options for button height, width & heading space
  • Improved: Controls and structure

1.1.0 - 26/10/2021

  • Added: Dynamic asset generation for inline styles
  • Added: Responsive control
  • Improved: Controls and structure
  • Improved: Inspector Panel Design & controls
  • Improved: Responsive Device Preview improved. Now the preview options synced with the wordpress's default preview button.
  • Improved: Security for asset generation

1.0.2 - 09-09-2020

  • Fix frontend js file missing issue

1.0.1 - 23-07-2020

  • Updated Block structure
  • Initial release

1.0.0 - 12-07-2020

  • Initial release

Upgrade Notice

[Major update] New structure and performance improvement, will break existing block.

About

Content Toggle Block for Gutenberg

Resources

Stars

6 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages