How to add the Konami code to your WordPress blog

The Konami code is a cheat code first popularized by the game Contra, where entering it would give you 30 extra lives. Since then, the code has been used in tons of video games and websites to unlock bonuses and easter eggs.

So how can you add it to your site?

There are probably a bunch of javascript libraries for it but I’m going to show you Konami JS by snaptortoise. Basically, you just take this block of code and include it somewhere in your site.

<script type="text/javascript" src="http://konami-js.googlecode.com/svn/trunk/konami.js"></script><script type="text/javascript">// <![CDATA[
	konami = new Konami()
	konami.load("http://www.google.com");
// ]]></script>

You’ll want to add it somewhere that will always be loaded by your blog, so someplace like header.php is a great place. From your dashboard click Appearance. Under Appearance you should see Editor. Click that next. Along the right hand side you should see a list of different files. Pick Header.

Now you just need to edit header.php. Putting the javascript in the <head> tag works great. Save it and you’re done. Try it out for yourself by pressing

up, up, down, down, b, a, b, a, enter

Right now, it just redirects you to whatever website is passed into the load() function. You can do other stuff with it too by passing in a function to the konami object like this.

konami.code = function() {
		alert("You have entered the KONAMI CODE!  You now have 30 lives.  Kinda.")
		}

In order to do this on a WordPress.com site, you’ll need to pay to be able to customize the look and feel of your site.

There is also a WordPress plugin written that will do this same thing called Konami Easter Egg.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>