Have you ever wanted to write something in a post for future reference? If so, here is the solution. Before getting into the code let me first explain a little. The note that is created will be visible only to you (admin). The note will be visible only to the user who has the right to publish posts – so it’s naturally going to be admin in most cases. The function is made into a shortcode so that it will be easy for you to handle. Here the procedure to set it up.
1. Paste the below code in your theme’s functions.php file.
function personal_note( $atts, $content = null ) {
if ( current_user_can( 'publish_posts' ) )
return '<div class="prnote">'.$content.'</div>';
return '';
}
add_shortcode( 'prnote', 'personal_note' );
2. Paste the below code in your theme’s Stylesheet.
.prnote
{
background-color:#ffffe0;
border-color:#E6DB55;
border-style: solid;
border-width: 1px;
padding:10px 10px;
margin-bottom:10px;
}
3. While writing posts, use the shortcode [prnote] as shown below.
[prnote]my first note. only i can see it.[/prnote]
See the below screenshot of my post page showing the note.
That’s it. Start making notes. It’s really useful.










Comments on this entry (1 comment)
Did you like this post? You can share your opinion with us! Simply click here.