Through using WordPress, I’ve discovered WordPress shortcodes and they are quick handy to use when you can remember how to reference them correctly! Hence why I’ve created this to help me and others when using shortcodes as a quick reference guide.
Things to Know
- WordPress shortcodes are case sensitive.
Referencing WordPress Shortcodes
In a post or page it looks like this when you are EDITING that post or page:
[shortcode] Some text goes here [/shortcode]
In a post or page (while editing), with attribute settings:
[CL-embed id="123" size="medium"]
In a source PHP file:
<?php echo do_shortcode('[CL-embed]'); ?>
WordPress Shortcode PHP Code Tips
How to make sure that you remove shortcodes before displaying contents:
$stripped_content = strip_shortcodes($content);
For more information visit the WordPress’s Shortcodes page.