Post Pic

Add private notes to your WordPress blog posts

Sometimes, you may need to leave a private note (Only visible to admins) to a post, but there’s no built-in solution in WordPress to do it. So, here’s a nice hack I use on my blogs.

Here's the code you need to add to your functions.php file:

add_shortcode( 'note', 'sc_note' );

function sc_note( $atts, $content = null ) {
	 if ( current_user_can( 'publish_posts' ) )
		return '<div class="note">'.$content.'</div>';
	return '';
}

Once done, simply add the following shortcode in your posts:

[note]
This is a personal note that only admins can see!
[/note]

Note that the note will be displayed with a <div class="note"></div> tags, so you can use it to give a specific style to your notes!

48 Responses

May 15 2009 18:47

Hey, That was an awesome Share. Nice idea.

The potential of functions.php is almost infinite :)

Cheers…

May 16 2009 03:53

Sweet little tip! Going to use this at Perishable Press. Thanks!

May 16 2009 07:27

I never imagined that Wordpress can do it. This platform is just amazing!

May 16 2009 10:07

This is really great, I usually just use notepads and its such a pain and you are right there are many times I want to add notes that only I can see.
Thanks again!
Ann

May 16 2009 16:06

Oh yes, it’s cool. WordPress and PHP have great resources.
This theme is very nice ;-)

May 16 2009 20:06

Very cool shortcode. If I ever had some some additional admin’s this could be very useful.

May 19 2009 00:45

Wow, this is a pretty nice little technique. At least this way, I won’t forget to update my typos and spellcheck things.

May 20 2009 10:50

Nice idea :-)

May 27 2009 17:55

OMG!
this is really fantastic code i think it is so useful and imformative post. Keep it up!

Jun 02 2009 09:08

WoW! That was awesome. Thanks a lot.

Jun 02 2009 11:17

That’s pretty straightforward but also kinda risky. If you accidentaly misspell something the note will be visible to everyone. I’d rather send an email to the other admins – takes only a bit longer.

Jun 07 2009 07:18

Great tips buddy. It would be a new change in my blog. I’m gonna implement it today itself..

Jun 07 2009 21:02

Its been almost an hour since I am on your website, and I’m learning something new every minute. Great work.

Jun 18 2009 16:11

Thanks for posting

Aug 17 2009 19:32

another nice useful tip, thanks..

Sep 14 2009 17:53

Very useful for multiple admin sites, thanks

Feb 06 2010 16:08

If I wanted to use this code, how exactly do I add the code to the function file. I use wordpress.

Thanks!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required