R – wordpress shortcode problem


Apparently the following simple code breaks the shortcode API of wordpress. When I add this code in the function.php the shortcode API won't work.
This code is normally to add a text at the bottom of each page, any idea why?

function cmstut_basic_promote($content)
 echo $content;
 <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>
add_filter('the_content', 'cmstut_basic_promote');

Best Solution

you must return the content from your filter not echo it - so something like

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

would be the way to go

Related Question