Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm sure this is a dup, but I honestly can't find an answer.

I'd like to add a message to the start and end of my posts:

"Check out my new startup: Facebook For Dogs!"

Is there a simple way to do this, hopefully using a plugin?

share|improve this question
    
If the answer below solves you problem please click on the tick mark. –  user983248 May 7 '12 at 12:38
add comment

1 Answer

up vote 5 down vote accepted

You'll want to hook into the_content to add a message.

Something like this:

<?php
add_filter('the_content', 'wpse51338_filter_content');
/*
 * Filter the content to add a message before and after it.
 */
function wpse51338_filter_content($content)
{
    // not a singular post?  just return the content
    if(!is_singular())
        return $content;

    $msg = sprintf(
        '<p class="special-message">%s</p>',
        __('Here is an awesome message!', 'your_textdomain_string') // this is your message
    );
    return $msg . $content . $msg;
}

As a plugin.

share|improve this answer
    
Awesome, thanks. I should have mentioned I'm a complete newbie. How do I install this plugin? –  Paul Biggar May 7 '12 at 5:38
    
you can paste this code in your functions.php file ;) –  Tom Sarduy May 7 '12 at 6:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.