wordpress短代码问题
问题描述:
显然以下简单的代码打破了wordpress的短代码API。当我在function.php中添加这段代码时,shortcode API将不起作用。 这段代码通常是在每个页面的底部添加一段文字,为什么?wordpress短代码问题
function cmstut_basic_promote($content)
{
echo $content;
if(is_single())
{
?>
<div class="promote">
<h2>Enjoy this article?</h2>
<p>If you have enjoyed this article please subscribe to our <a href="<?php bloginfo('rss2_url'); ?>">RSS Feed</a></p>
</div>
<?php
}
}
add_filter('the_content', 'cmstut_basic_promote');
答
必须返回从过滤器中的内容不回应吧 - 所以像
function cmstut_basic_promote($content) {
if(is_single()) {
return $content . '<div class="promote"><h2>Enjoy this article?</h2> ...';
} else {
return $content;
}
}
是去
是的,感谢的方式:D只是WordPress插件开始 – Christophe 2010-01-31 12:30:01