Skip to content

Instantly share code, notes, and snippets.

@thesmart
Last active November 15, 2024 00:17
Show Gist options
  • Save thesmart/40c40f26fc9179c0ab4ac7f36d13d209 to your computer and use it in GitHub Desktop.
Save thesmart/40c40f26fc9179c0ab4ac7f36d13d209 to your computer and use it in GitHub Desktop.
Opens all accordion content sections on a wordpress site.
const contentWrappers = document.querySelectorAll('.wp-block-getwid-accordion__content-wrapper');
contentWrappers.forEach((wrapper) => {
wrapper.style.display = 'block';
wrapper.style.height = 'auto';
wrapper.ariaHidden = undefined;
wrapper.inert = false;
});
@thesmart
Copy link
Author

thesmart commented Nov 15, 2024

Instructions for use:

Step 1: Open the Developer Tools

  1. Open the website where you want to run the JavaScript code.
  2. Right-click anywhere on the webpage.
  3. From the context menu, select Inspect or Inspect Element (the exact wording may vary depending on your browser).

Alternatively, you can press the following keyboard shortcuts to open the Developer Tools:

  • Windows: F12 or Ctrl + Shift + I
  • Mac: Command + Option + I

Step 2: Switch to the Console Tab

In the Developer Tools window, click on the Console tab.

If you don't see the Console tab, click on the >> icon (three horizontal lines) in the top-right corner of the Developer Tools window and select Console from the dropdown menu.

Step 3: Run the JavaScript Code

Copy and paste the javascript code and hit enter to run the code. Click X to close the tools menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment