Forums

how to add text to every post (4 posts)

  1. digitalartempire
    Member
    Posted 1 year ago #

    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]

  2. TM3909
    Member
    Posted 1 year ago #

    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/

  3. digitalartempire
    Member
    Posted 1 year ago #

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

  4. TM3909
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.