Posts tagged as "shortcode"

WordPress Shortcodes; Documenting The Undocumentable

WordPress shortcodes. A great idea. Small snippets of text with a special meaning, enclosed in left and right angle brackets. Put one of these in a WordPress post or page and WordPress automagically expands the shortcode and replaces it with the thing that the shortcode does.

WordPress has a built-in set of shortcodes and many plugins add to this repertoire, adding one or more of their own shortcodes. But here's the problem. Shortcodes are meant to be expanded and in 99.999% of cases, that's just what you want to do. But what happens if you're one of those 0.001%; you've written a plugin that adds a shortcode and you want to document it. You can't just write the shortcode in a post as WordPress will go ahead and expand it for you.

You could take the time and effort to replace the [ and ] characters which surround a shortcode, writing something like [shortcode], which is exactly what I've been doing since I released the first version of WP Biographia. But this is a long and laborious process. Frankly, it's boring and a pain in the backside.