Introduction
Ever wanted to have an attractive, animated, styled spoiler container for you and your users? Easy Spoiler is a free plugin to provide just that. It is quite simple, and works in pages, posts, comments, and widgets. Read on through this tutorial and if you have any questions or comments, feel free to post.
You can download the latest version here:
Easy Spoiler
And read the FAQ here:
Easy Spoiler FAQ.
And visit the support forum here:
dyerware Forums.
Examples
You surround the content you wish to hide between the “spoiler” tag. Any content is allowed, including HTML, and other shortcodes. For a simple introduction, the following text
[spoiler] Your stuff here… [/spoiler]
would look like this:
You operate the spoiler by clicking on the show/hide button. You can customize the spoiler with a hint as well as override the intro text:
[spoiler intro="Armor Help" title="Locations of armor vendors"] Your stuff here… [/spoiler]
The contents within a spoiler can be complex HTML and other shortcodes. Below is an example with our Easy Chart plugin embedded:
[spoiler intro="Answer" title="Flavor Sales"]
[easychart type="vertbar" height="300" width="350" groupnames="Chocolate, Vanilla, Strawberry, Mint, Peach" valuenames="1999, 2001, 2003, 2004, 2007, 2008" group1values="2069, 1184, 2389, 820, 2398, 701" group2values="2002, 1177, 2825, 697, 3226, 993" group3values="4071, 824, 505, 100, 230, 0" group4values="0, 163, 320, 145, 0, 121" group5values="0, 0, 143, 70, 565, 102"] [/spoiler]
becomes…
Now, don’t fret the crazy argument options. You can use the admin panel GUI to set up your defaults, and you can use the new buttons this plugin adds to your HTML editor to make adding spoilers a snap. More on that later though.
Spoiler Groups
You can cluster a group of spoilers together using the spoilergroup tag. This will create a visual cue to their relationship and auto-close one when another is opened. To use the spoilergroup tag, you simply sandwich your spoiler tags between it:
[spoilergroup
]
[spoiler intro="Answers" title="Question 1"]in post 1[/spoiler]
[spoiler intro="Answers" title="Question 2"]in post 2[/spoiler]
[spoiler intro="Answers" title="Question 3"]e=mc^2[/spoiler]
[/spoilergroup
]
will give you:
Go ahead and play with opening them to get the idea.
Using the Spoiler Editor Buttons
Easy Spoiler adds two buttons to your HTML editor. You can turn off the buttons if you don’t like them (use the admin panel):
Here you see selected text, and the editor toolbar has two new buttons “spoiler” and “spoiler group”. By clicking on “spoiler”, the selected text will become a spoiler.
If there were several adjacent spoilers and we wanted the group feature, we would highlight the spoilers and click on “spoiler group”. Done! You can always edit the spoiler shortcode that was inserted to get specific. Keep in mind that if you always want a particular style or behavior, use the admin panel to tune the defaults to the way you want things to be.
Spoiler in-the-wild
For an example of the spoiler plugin on a production website, visit
5 Things you must do in Fallout 3
This article shows several dyerware plugins (easy spoiler, easy review, gallery and caption):
http://www.techulous.com/reviews/review-bioshock-2-part-1.html
Admin Preferences
Easy Spoiler now has an administration preferences panel under your wordpress settings area. Currently, there are two main sections on this page, “Parameter Defaults” and “Global Defaults”.
You can use the Parameter Defaults section to configure default values for the spoiler shortcode so you do not have to constantly provide your own customizations each time you specify a spoiler.
Also, you can use the Global Defaults to change some behaviors, such as turning the animations on or off, and assigning your own text for the Show and Hide buttons.
When making changes, do not forget to click on Save Changes! If you get a little lost, you can always click on Reset Settings which will reset the plugin to the way it was originally.
Usage
Now that we have seen it in action have some idea as to what you want to build with it, lets go over each parameter in detail. Anywhere (and even more than once) within a page or post you may enter the following to insert a spoiler:
[spoiler (optional parameters go here)] The Spoils [/spoiler]
While the spoiler innards can be on as many lines as you wish, It is very important that all of those optional parameters appear on the same line and are all lower case (the line can be very long, of course). The plugin has had an addition made to detect malformed arguments and abort processing. This helps you recognize a formatting problem. If you experience this, you will see the following text along with some help information on your post or page: “EASY SPOILER SHORTCODE ERROR”.
It is recommended that you enter these shortcodes in the raw HTML editor and not in a WYSIWIG one. This also avoids the unintentional insertion of HTML code that would otherwise malform your parameters and input text.
Ok, enough of that. Lets go over each easyspoiler parameter:
title (optional)
Example : “Location of the bad guy”
Description: Adds a title to the spoiler. The default is to have no title.
intro (optional)
Example : “Answer”
Description: Customize the text preceding the title. Default is “Spoiler Inside”.
tablecss (optional)
Example : “yourCSSName”
Description: Customize the spoiler container’s CSS Class.
And Wrapping Up…
Your thoughts are always welcome! Please post here any issues or suggestions.
Hi,
how can I update the plugin in that way, that an open spoiler will be closed when I open a new one? Like in an Accordion Menu or something else? Is this possible an if, how will it work?
Best Regards ans thanks!
Currently it is not possible, but a good idea for a future update. Perhaps surround the spoilers with a spoilergroup tag.
Thanks for your answer. How can I surround the spoilers with a spoilergroup tag and what should be written in this tag? It would be very nice if this function would be added in a new version of the plugin.
Do,
I will have to add the feature. There is no group tag at the moment. The group tag was just a thought on how it could be done. Ill try to get to it soon.
Thanks for your work. In which time do you think you could do it? Will the update be found on this page, or would you send it to me via E-Mail?
For example you can look at the wp dojoloader plugin. There the function is given, but it doesn’t work in my wp. Otherwise I found your plugin better to include and use. Thanks one more time for this.
Should not be a problem to add something over the weekend. An ecb update is putting the spoiler update on the back burner, but it looks to be wrapping up quickly.
Updates are announced over twitter (dyerware), and through the wordpress plugin admin page. I’ll zap you a courtesy email as well.
Checking here also works.
Hey,
thanks for the very fast update. The new function works fantastically in the site. You can look at it under the link.
Just the border at the bottom of the last wrap I can’t delete. I don’t found the right place in the css, but it’s not so bad.
I will have a look on your site for new updates and functions.
Maybe an easy shop plugin would be nice for the future!
Thanks a lot
[…] Erst auf euren ausdrücklichen Wunsch werden diese angezeigt. Dies habe ich mit dem Easy Spoiler Plugin für WordPress […]
[…] The ending of the comic where the shark burst out of the trashcan blew my mind! Just click the “SHOW” button to reveal the text. Until then, it’s hidden. Pretty nifty, huh? (And if you want to learn more tricks with this plugin, feel free to check out the tutorial created by the author.) […]
wonderful button, and it strangely suit for my template :). Damn good!
Just what I was looking for! It such as spoiler for my movie site. 🙂 Works great and so easy to use and remember. Thanks so much! Great Work 🙂
This is a great plugin. Thanks for contributing this. How do you change the formatting so that it doesn’t use the dashed lines around the spoiler content?
Here is an example: http://neuropathytreatmentgroup.com/faqs
Thanks.
look in the css file in the plugin folder
Hi,
how do you set one of the options of a spoiler group to open by default when the page is loaded?
For instance: http://irishpinkadoptions.com/2010/06/26/what-is-family-online-tv-anlar-ie-asked-us/
thanks
Right now there is no way to do it, but I can add it relatively easy. When I find time I need to update a lot of these plugins, so Ill make sure to add this.
Hi..
I just want to ask one questions for you.
How to change ‘Show’ and ‘Hide’ button with images?
I can to change that? How?
Thanks 🙂
No, but you can change their text to be anything you want in the admin plugin page. Sorry, no images. Maybe one day 🙂
http://www.alojaimagens.com/images/6zckxxtsfv8w23jgq870.png
Hi! How remove the bar?
Can you post a link to a page on your site that shows this? Then I will study the HTML and come up with the answer.
Hello,
Very nice plugin you have here. I have a question though.
I have some content which I need to present to my readers on all my posts and I do not want search engines to detect it as duplicate content. That one content need to show on all the posts.
Do you think this will help? Can I just add the content once and make it show on my posts using the shortcode. Will it be seen as duplicate content?
Thanks for your help.
Hi, first of all thanks for published this great plugin. I have a question regarding to the plugin usage. I plan to use this plugin in a custom field. The value i will key in the custom field is something like.
I put above value in my custom field but it show exactly the same text on my site. I guess the plugin doesn’t has effect on value in custom field. How can i get it to work? I love to use this plugin but i have to use it in custom field. Thanks in advance.
I’m sorry, pretend I am an idiot for a moment (I assure you that is not hard): What do you mean by custom field? Do you mean sidebar html widget?
Hi, thanks for your reply. The custom field can be found when you create a post. In wordpress, go to Posts > Add new > Custom fields section is located on the bottom of the page.
Great plugin, useful for hiding/showing the answers to quizzes for esl students on my site.
Just one problem- I’m getting an extra line at the bottom that’s rather ugly. It looks like it’s an additional empty spoiler. Shows up in groups or individual spoilers.
You can see it here: http://englishteacherfred.com/easy-english/english-quiz-1-easy/
Thanks a lot, next I will be checking out your review plugin.
Looks like you have lots of CSS rules that are overriding the plugin style. THat isn’t an extra row but an end-cap. I used safari and inspect-element (mozilla has better tools for this btw) to determine the culprit appears to be (div.post table td)
may i know.how i can put the Default Title Text at Parameter Defaults change with title in my post… so it can different every post automatically
Hi,
Sorry I don’t quite understand what you are asking. But let me try:
If you want to change the text at the top of each spoiler, specify the following within the opening spoiler tag:
intro=”intro text”
and
title=”title text”
If this is not what you are looking for, just give us a shout.
I have 2 questions:
1. I registered on the forum and when I try to log in (by entering my username and password that was emailed to me) it gives me a popup that won’t accept my username and password.
2. I love your plugin and it works great on some of my sites. But I just put it on one site that the format is out of wack. The top and the bottom of the box is too high. Can you please tell me what I might have wrong on the site? http://jerryhball.com/2009/04/it-seems-they-left-too-soon/
Hi kegan. It seems to be the style.css overriding the th and tr rules, and i think table. If you wanted to experiment you could rename the style.css (so it isn’t read) and see.
CSS rules can be a mess.
Also, odd about the forum. Ill have to check that.
Hi! I want to use this great plugin in a theme template. I need to include some static text under the spoiler in the single.php So, how can I do it? Is it possible to call it (probably with some options)?
I’m not sure. It uses the wpress loop by registering for some key events. You could call those. Keep me posted if you have make some tweaks.
Hi – this looks like a great plugin!
Can I use it with WP Thesis?
What is wp thesis? A theme?
It’s the DIY Themes from wordpress. When I try to get your plugin, it tells me:
“Warning: This plugin has not been tested with your current version of WordPress.”
I have WP version 3.01 and Thesis DIY Theme.
Oh I see. Yes all our plugins work w/ 3.x. I need to update the Plugin page 🙂
Great! I’ll look for the update. Thanks for your help!
Love the plugin. It’s exactly what i’ve been looking for. One question…..my site has it working fine but my “Show/Hide” buttons don’t look as good as the ones in these examples. Is there something I could do to get that same look that you have.
Also, when viewing the page with Google Chrome the first “Show/Hide” button looks different than the others. Any idea what could be causing this? Any help would be greatly appreciated.
My page: http://frankiesgun.com/main/lyrics/
Sean,
Nice site you have there.
Actually the first button is the correct one. Some theme-oriented snafu stopped the CSS rules for the remaining buttons (it is not chrome). I can’t look into it right at the moment, but if you shout back at me in a week Ill be able to look at it.
I need to update this and a few other plugins with better CSS controls.
Thanks so much. I’ll be checking back soon and hope to have it worked out. To be honest – they work fine as it is. I’m just hoping to make them look a little smoother, like the ones in your demos. You rock. Thanks
please, in next version validate this plug-in for satisfy W3 standards.
thank you
i got some trouble when i wanna use list in spoiler. the preface was not good. Do i should add code ?
interesting plugin.
Will this plugin work with show/hiding portions of a table?
e.g. using spoilergroups as headers for each portion of table, with the user being able to hide or expand that section of table.
Thanks
You can hide a cell’s contents, but you can’t use it to break up the table per-se. I suggest you look at the spoilergroup feature which allows you to have a list of spoilers.
Also, you can put HTML and other objects within a spoiler (so you could have an entire table inside for example)
Awesome plugin! Thanks a lot for it!
I am revamping my website soon and your plugin is going to help me with my new site. I do have a couple questions though.
#1. Is there a way to make the entire bar clickable, instead of clicking on “show” and “hide”?
#2. If #1 is not possible, then how can I get rid of that vertical bar that is between the text and the clickable button?
#3. Again, if #1 is not possible, how can I move the “show” & “hide” button so it isn’t so far towards the right?
Thanks in advance for any help you can offer! This really is a great plugin and I do plan on sending you a donation to show my support once I roll out my revamped site for good.
Forgot to give you a link to my current/test site that this plugin is installed on.
http://myworthlesscrap.com/WordPress/?p=32
Chris,
Looks like your theme overrides table th. Look for this rule:
table th { border: 1px solid #CCC; background: #EEE; }
in your/wp-content/themes/arras-classical-gamer/styles/white-rtl.css file. If border was 0px rather than 1px it will look great.
I will update the plugin to add to the spoiler’s own .css to combat this.
Ah, thanks! I changed it and now that bar is gone. Any idea on how to make the whole bar clickable, or is that not possible maybe?
There is a way to make the title clickable, but it would require an update to the spoiler code. Let me see what I can do
That would be super awesome! Thanks!
I can not insert images as the example:
http://www.comfamiliar.org/wp-content/uploads/2011/02/insertarfoto.jpg
Replace the respective parens with the correct bracket, etc. Don’t forget your align style.
(spoiler)
(img src=”xxx.png” width=”200″ height=”200″ /)
blah blah blah…
(/spoiler)
Please use the support forum for new comments:
http://www.dyerware.com/forum
Thanks!
[…] of the reasons I came up with this is that I found this great little plugin called Easy spoiler that enables you to post, hide and show a spoiler within your blog post. Apart from spoilers in […]
[…] fresh… and of course… Easy Spoiler documentation can be found here. Share this:FacebooktumblrShareEmail Posted in […]