A snippet to add any content (including HTML, PHP) as a WordPress shortcode for output onto your WordPress site. Simply open up your theme (child theme) functions.php file and add the following function:-
Then in your WordPress site's content editor add the shortcode [anycontent] and your custom content will be outputted using 'output buffering'.
Example Use: Output X Theme Tags anywhere on a post
WordPress Custom Shortcode Plugins
Of course, WordPress plugins can also come to the rescue here and Shortcoder is a good one, but it's always nice to do this yourself to save additional Plugin bloat on your WordPress site.
Join in the Discussion