Some Longer Text function shortcode_example1() { return 'Some Longer Text'; } add_shortcode('tag1', 'shortcode_example1'); // [tag2 param="something"] -> Some Longer Text and something function shortcode_example2($attr) { return 'Some Longer Text and '.$attr['param']; } add_shortcode('tag2', 'shortcode_example2'); // [tag3]something[/tag3] -> You just said "something", didn't you ? function shortcode_example3($attr, $content) { return "You just said '$content', didn't you ?"; } add_shortcode('tag3', 'shortcode_example3'); // [tag4 any attribute]something[/tag4] -> Attributes: [list of attributes and values]. Content: [content] function shortcode_example4($attr, $content) { $attributes = ''; foreach ($attr as $key=>$value) { $attributes .= "$key: $value\n"; } return "Attributes: $attributes
Content: $content"; } add_shortcode('tag4', 'shortcode_example4'); ?>