Header menu


Wednesday, 30 October 2013

Add shortcode to template file in woocommerce or wordpress

Shortcode API, a simple set of functions for creating macro codes for use in post content. It enables plugin developers to create special kinds of content (e.g. forms, content generators) that users can attach to certain pages. For instance, the following shortcode (in the post/page content) would add a photo gallery into the page:     [gallery]

But this syntax work for only wp-admin post editor. If you want to add shortcode to your template file then you can use

        echo do_shortcode( '[shortcode_name]' );
It will do same work as done by shortcode when it is added to post...