WordPress do_shortcode

Having a shortcode in the normal editor window can cause problems when clients edit their content. It is very easy for them to delete or modify the code causing issues that they will be in contact about. One easy way around this is to have the shortcode coded into the page template by using the do_shortcode function, for example adding a gallery.

<?php echo do_shortcode('[album id=1 template=compact]'); ?>

WordPress Codex references for code used in this example:-
http://codex.wordpress.org/Function_Reference/do_shortcode

Leave a Reply

Your email address will not be published. Required fields are marked *