‘Shortcodes’ are a feature of wordpress used for executing custom functions by inserting a small snippit of code into a post.
The shortcode syntax varies, here are some examples:
[shortcode][shortcode atribute="value"][shortcode]Text[/shortcode]
Shortcodes can be created to perform a handful of useful functions. To use the shortcode in this post I recommend adding the function to your functions.php theme file (create it if it does not exist!).
This is the funtion:
function adsense_shortcode( $atts ) { extract(shortcode_atts(array( 'format' => '1', ), $atts)); switch ($format) { case 1 : $ad = '<script type="text/javascript"><!-- google_ad_client = "pub-5225394714568485"; /* 250x250, created 3/11/09 */ google_ad_slot = "9746597999"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>'; break; } return $ad; } add_shortcode('adsense', 'adsense_shortcode');
Remember to replace the adsense code with your own from google. Now you can output an ad simply using [shortcode here].
Add additional ad formats to the switch statement and you can output other ad formats using, for example, [shortcode here format="2"].
CHANGE “shortcode here” for the shortcode name, in this case is “adsense”.

