开发者

Making a plugin operate through a shortcode

Many plugin need some [shortcode] t开发者_如何学Co be placed in a page, sometimes within the loop. But usually it only makes the actual [shortcode] appear where I placed it and nothing else !

For example such and such contact form plugin asks me to put [contact form plugin] in my contact page and I'm supposed to see a form appearing there as a result, but instead I see a blank page with the shortcode appearing.

I'm relatively new to WordPress so this question must sound stupid, stil can anybody take the pain to explain to me ?


AFAIK, [shortcode] is intended to be appeared or operated within the loop. if you want it to display outside it (says, on sidebar, or on footer) you need to manually compute it's value.

To do that, you can use do_shortcode() function:

<?php echo do_shortcode ( '[your-shortcode-text]' ); ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜