How do I code a Spoiler element that cannot be opened?

noellarkin

Senior Member
Joined
Mar 14, 2021
Messages
1,006
Reaction score
1,492
I'm talking about these
text here - and if the Spoiler Title button didn't work, it'd technically be a form of 'soft' cloaking lol

How do I make one of these that don't open if you click it (but still have paragraphs inside).
 
A lot of ways you could do this, if you're using a pagebuilder on your Wordpress site they usually have widgets called "Toggle" or "Accordion", that could probably achieve what you're looking to do without going to code heavy
 
A lot of ways you could do this, if you're using a pagebuilder on your Wordpress site they usually have widgets called "Toggle" or "Accordion", that could probably achieve what you're looking to do without going to code heavy
Don't use a pagebuilder, thta's unnecessary bloat

just use CSS and some JavaScript
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_tabsthen just make it "unclickable" if you don't want it to open at all :)

Like add
.tablinks{
pointer-events: none;
to the css
 
Last edited:
Don't use a pagebuilder, thta's unnecessary bloat

just use CSS and some JavaScript
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_tabsthen just make it "unclickable" if you don't want it to open at all :)

Like add

to the css

Haha yeah definitely don't install a pagebuilder solely for adding a spoiler/read more type button, just an option if your're currently using one.

Another option if you ain't too savvy with CSS and JS would be a plugin such as this that you can add directly to Gutenberg:

https://wordpress.org/plugins/gosign-readmore-toggle-text-block/
 
A lot of ways you could do this, if you're using a pagebuilder on your Wordpress site they usually have widgets called "Toggle" or "Accordion", that could probably achieve what you're looking to do without going to code heavy
Thanks, I already have a shortcodes plugin for spoilers, I was looking specifically for a hack that allows me to make the accordion Non-Functional - - so I can stuff keywords into the description of it and it won't open when someone clicks it.
@xReminisce cleared it up for me with that CSS snippet a few messages ago :)
I love how many ways one can cloak content, this is what makes SEO fun :)
 
Back
Top