php - Trying to use WP shortcode in HTML -
i'm trying make shortcode outside post/page in wordpress.
the problem is, when i'm placing do_shortcode()
function, html automatically document php code (e.g <!--*php code* -->
).
what can cause problem?
you don't place do_shortcode() in pages. somewhere in functions.php or shortcodes.php file set function , assign shortcode function.
function myfunction($params = array()) { //function code here } add_shortcode('shortcodename', 'myfunction');
then once done can put [shortcodename] pages, inside square brackets that. there plugins allow run php , enter right on page, default shortcode functionality requires add shortcode first.
Comments
Post a Comment