[英]do_shortcode showing as a string in post - WordPress
I have a short code [wtilikepost]
that when added to a post will show a like dislike buttons. 我有一个简短的代码[wtilikepost]
,当将其添加到帖子中时,将显示不喜欢的按钮。 But I want to add the short code directly to the my template in the PHP I thought I could just 但是我想将短代码直接添加到我认为可以的PHP模板中
<?php echo do_shortcode( '[wtilikepost]' ); ?>
All that does is output the string "wtilikepost" 所有要做的就是输出字符串“ wtilikepost”
Do i need to add something else to my functions.php file? 我是否需要在我的functions.php文件中添加其他内容?
Try this: 尝试这个:
<?php
if( shortcode_exists( 'wtilikepost' ) )
do_shortcode( '[wtilikepost]' );
else
echo "The shortcode <b>wtilikepost</b> is not installed.";
?>
This way you will be able to know if it's recognized or installed. 这样,您将能够知道它是否被识别或安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.