Support » Fixing WordPress » how to add text to every post

  • how to add text to every post – I need it to say some thing like “please like our fb page thnks ” i just wanted to check where it is safe to add it — i thought single post .php would work i put an add in there ok before — but where to add it so it shows at the top ? or before related posts ?

    cheers

    this is my current single post code

    [code moderated – please use the pastebin]

Viewing 3 replies - 1 through 3 (of 3 total)
  • My favorite way of doing this is via a filter:

    add_filter ('the_content', 'insertSubscribeNewsLetter');
    function insertSubscribeNewsLetter($content) {
       if(is_single()) {
          $content.= '<div style="border:1px dotted #000; text-align:center; padding:10px;">';
          $content.= '<h4>Enjoyed this article?</h4>';
          $content.= '<p><a href="http://facebook.com/YOURURL/">Check us out on Facebook!</a></p>';
          $content.= '</div>';
       }
       return $content;
    }

    That will append onto each post if the user is on a single page. There are other ways of doing this, you can check a great list out here: http://ithemes.com/automatically-add-content-to-your-wordpress-posts-and-pages/

    ok awesome thnks – i added some ad code direct;y to the simgle post php – is this an ok way of doing it too ?

    Yes, there’s no reason you can’t do that. You’re good to go!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to add text to every post’ is closed to new replies.