Tech Tuesday : Create spoilers in Blogger and Wordpress
Scribbled at 4:31 am | Tagged as: Blogging, Technology | My mood is:
Cool,
Thumbs Up. |
Its been a while since I wrote a tutorial yea? Here’s something about spoiler tags and how to include them into your blog. This tutorial is for both Wordpress.org hosted blogs and free Blogger/Blogspot blogs.
Spoilers for WP
The Wordpress plugin that im currently using to hide my spoilers is wpSpoiler. This is especially useful when I want to write reviews on movies or books and I don’t want to reveal information that might spoil it for someone else.Click for Spoiler
How do you add this plugin to your website? Just download it from the site (click the link above), make changes in the PHP file to change the language and wallah! All you have to do is put your info between tags like this [ spoiler ] This is a hidden text [ /spoiler ] and you’re all set.
Ahh the wonders of Wordpress. Thats so easy, I hear you say. But what about people who are using Blogger to host their website? Next up…
Spoilers for Blogger - Part 1 :Editing the Theme
This is for you folks who host your blogs on blogger and have blogspot.com in your blog URL. It requires a little more work and is a bit more complicated so listen up.
First of all, go to your Dashboard >> Template >> Edit HTML
Then look for this line: ]]></b:skin> and </head> . There are two parts of codes.
First part, insert this code BEFORE ]]></b:skin>
.commenthidden {display:none;}
.commentshown {display:inline;}Then add this code AFTER ]]></b:skin> and BEFORE </head>
<script type=”text/Javascript”>
function togglecomments (postid) {
var whichpost = document.getElementById(postid);
if (whichpost.className==”commentshown”) { whichpost.className=”commenthidden”; } else { whichpost.className=”commentshown”; }} </script>
Your HTML coding should now look like this. Example:

Save settings. Thats one part done. Phew!
Spoilers for Blogger - Part 2 : Creating spoilers in blog post
To add spoilers to your blog post, click Create A Post and click Edit Html (its on the top right next to ‘Compose’). Then add this bit of code:
<a aiotitle=”click to expand” href=”javascript:togglecomments(’SPOILER_NAME‘)”>Click me to read spoilers</a>
<div class=”commenthidden” id=”SPOILER_NAME“>put your hidden text here</div>
You can change SPOILER_NAME to anything you want but make sure that they are both EXACTLY the same. The <a aiotitle> and <div> dont have to be close to each other, as long as they are in the same post and have the exact same name. It will work.
Good luck and I hope this tutorial helps!

March 11th, 2008 at 11:17 pm
hi fiona..
thanks di atas komen awak kat blog khai tu.. mmg powerfull lah.. uhhu… tq tq..
pasal wp-spoiler ni, khai lebih suka biasa je.. bila orang click read more dan dia baca sampai abis dalam page baru tu, so akan terus nampak comment form.. so diorang berkemungkinan akan rajin komen… daripada baca semua artikel tapi x nampak tempat nak komen…
March 12th, 2008 at 3:18 am
I guess this doesn’t work in Wordpress because WP editor will remove the Javascript tag.
March 12th, 2008 at 4:26 am
nie bukan plugin “Read More here” tu…nie plugin utk tulis spoiler dlm text, contoh bila nak review movie tp nak hide part yg jadi spoiler
@ tk2
Wordpress uses the plugin wp-Spoilers. The javascript one is for Blogger.com as I already mentioned
March 12th, 2008 at 5:44 am
Sorry..
I skipped the 1st paragraph and went straight to the code.
March 19th, 2008 at 6:09 am
alamak!! setelah diulang baca beberapa kali, now dah paham!! hihi..
ala, kira ada juga yang pasang plugin ni untuk read more kan? tekan je terus entri keluar sampai abis…
March 19th, 2008 at 6:12 am
March 19th, 2008 at 7:49 am
[...] guys! Tuesday again, time for another tutorial. Was my last tutorial about spoilers helpful? I hope so. Sorry couldn’t upload this post earlier, my internet was down because my [...]
March 26th, 2008 at 2:59 am
Thanks a lot, great work, really appreciated.