How to insert shortcode in WordPress?
When working with a custom theme in WordPress you might want to add the functionality of a plugin directly into a template or php file. Many plugins offers shortcodes to be used with different parameters. This is how to insert the shortcode in WordPress custom themes, templates and php-files:
The WordPress shortcode
The shortcode might look something like this:
and can be pasted directly into posts and pages through the WordPress admin.
How to insert shortcode in wordpress php-files
Simply pasting in [nggallery id=1] in a php-file will not work. To use shortcodes in WordPress php-files you need to use WordPress function do_shortcode();
Something like this:
<?php echo do_shortcode('[nggallery id=1]'); ?>