2010-01-31 5 views
1

분명히 다음의 간단한 코드는 wordpress의 shortcode API를 해독합니다. function.php에이 코드를 추가하면 shortcode API가 작동하지 않습니다. 이 코드는 일반적으로 각 페이지 하단에 텍스트를 추가하는 것입니다. 그 이유는 무엇입니까?wordpress shortcode problem

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'); 

답변

2

당신이 그것을 표시하지 필터에서 콘텐츠를 반환해야합니다 -

+0

네, 덕분에 갈 수있는 방법이 될 것입니다

function cmstut_basic_promote($content) { if(is_single()) { return $content . '<div class="promote"><h2>Enjoy this article?</h2> ...'; } else { return $content; } } 

같은 무언가를 : 단지 워드 프레스 플러그인로 시작하는 D – Christophe