AI Verified

Name

Block Editor: Alt+Shift+Pipe/Backslash to Toggle Right Sidebar [SnipSnip.pro]

About

ADMIN ONLY • This code snippet enhances the Gutenberg Block Editor in WordPress by adding a keyboard shortcut. By pressing Alt+Shift+Pipe/Backslash, users can toggle the Right Sidebar. This feature improves the editing experience and helps users navigate through their blocks more efficiently. The code snippet is provided by SnipSnip.pro and can be found at <a href="https://snipsnip.pro/s/437" target="_blank" rel="noopener">https://snipsnip.pro/s/437</a>

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

Set it to Admin Only, Activate. Try the keyboard shortcut in the Block Editor.

Link for further information:

The author has provided the following URL that may be helpful to setting up or using this snippet:

https://snipsnip.pro/s/437

Codevault

brandonjp

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Snippet Source:

https://snipsnip.pro/s/437

History

Last modified:

10/12/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Block Editor: Alt+Shift+Pipe/Backslash to Toggle Right Sidebar [SnipSnip.pro]

 
                    
1if (!class_exists('BlockEditorToggleRightSidebarClass')) {
2 // Block Editor: Alt+Shift+Pipe/Backslash to Toggle Sidebar [SnipSnip.pro] - https://snipsnip.pro/s/437
3 // This script adds a keyboard shortcut of Alt+Shift+Pipe/Backslash to the Gutenberg Block Editor to open/close the Right Sidebar
4 class BlockEditorToggleRightSidebarClass {
5 public function __construct() {
6 add_action('admin_print_footer_scripts', array($this, 'toggleRightSidebarPHP'));
7 }
8 
9 public function toggleRightSidebarPHP() {
10 if (!function_exists('\get_current_screen')) {
11 return false;
12 }
13 $screen = \get_current_screen();
14 if (method_exists($screen, 'is_block_editor') && $screen->is_block_editor()) {
15 ?>
16<script>
17 (function(){
18 const toggleRightSidebarJS = () => {
19 document.addEventListener("keydown", function(e) {
20 if (e.shiftKey && e.altKey && e.keyCode === 220) {
21 e.preventDefault();
22 let el = document.querySelectorAll('button[aria-label="Settings"]');
23 el && el[0] && el[0].click();
24 }
25 });
26 };
27 document.addEventListener("DOMContentLoaded", toggleRightSidebarJS);
28 console.log('Block Editor: Alt+Shift+Pipe/Backslash to Toggle Sidebar [SnipSnip.pro] - https://snipsnip.pro/s/437');
29 })();
30</script>
31 <?php
32 }
33 }
34 }
35 
36 new BlockEditorToggleRightSidebarClass();
37}

0

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

AI Verified

0

Show content to logged in User only

Added: 10 months ago

Last Updated: 10 months ago

Show content to logged in User only

WordPress Admin

Pro Verified

0

Flamingo - Editor Role

Added: 1 year ago

Last Updated: 1 year ago

Grants permissions to Flamingo (Contact Form 7 submissions) for Editor role.

WordPress Admin

AI Verified

1

Link to clear Bunny CDN

Added: 4 months ago

Last Updated: 4 months ago

I wanted a way for my clients to have a one click "Clear Bunny CDN" without having to go into other settings. Worked with AI and BunnyCDN support on this.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Security

AI Verified

1

Users: Create & Delete n New Users in WP Admin [SnipSnip.pro]

Added: 9 months ago

Last Updated: 6 months ago

Users: Create &amp; Delete n New Users in WP Admin [SnipSnip.pro] - <a href="https://snipsnip.pro/s/799" target="_blank" rel="nofollow noopener">https://snipsnip.pro/s/799</a> - This creates then dele...

WordPress Admin

AI Verified

1

Randomize a Post Publish Date in the Classic Editor [SnipSnip.pro]

Added: 9 months ago

Last Updated: 9 months ago

<p>Randomize a Post Publish Date in the Classic Editor. Choose between the past 1, 3, 6, 12 months... or customize it to other options. Works in the Classic Editor only for now. <a href="https://snips...

WordPress Admin

AI Verified

1

Disable Jetpack Promotions and Notices in WP Admin [SnipSnip.pro]

Added: 8 months ago

Last Updated: 7 months ago

Disable Jetpack Promotions and Notices in WP Admin [SnipSnip.pro] - <a href="https://snipsnip.pro/s/629">https://snipsnip.pro/s/629</a>