Wordpress短代码显示在模板中

问题描述:

I would like to hardcode this WordPress short code in my template file. Is there a way to do it?

[wunderground location="Philadelphia, PA" numdays="3" layout="simple"]

Currently only works if i add into Page WTSIWYG

我想在我的模板文件中对此WordPress短代码进行硬编码。 有办法吗? p>

  [wunderground location =“Philadelphia,PA”numdays =“3”layout =“simple”] 
  code>   pre> 
 
 

目前仅在我添加到Page WTSIWYG p> div>时才有效

Try this:

<?php echo do_shortcode("[shortcode]"); ?>

Reference: http://codex.wordpress.org/Function_Reference/do_shortcode