WordPress provide private feature to make your post or page only visible to other editors or site admin. Once a post is set to private, regular visitor won’t be able to read the post. Now, what a about if We want to hide only a part of the post? This code snippet will show You how to do it. Read More: http://www.dynamicwp.net/articles-and-tutorials/hide-a-part-of-wordpress-post-or-page/
PHP
put the code to function.php file of active theme
and to hide a part of the post, put it between [hide] and [/hide]
function Wp_UCanHide($text) { global $user_ID; if ($user_ID == '') { $posdebut = strpos($text, '[hide]'); $posfin = strpos($text, '[/hide]'); $posfin = $posfin + 5; $texttohide = substr($text,$posdebut,$posfin); $text = str_replace($texttohide, "", $text); return $text; }else{ $text = str_replace('[hide]', "", $text); $text = str_replace('[/hide]', "", $text); return $text; } } // Apply the filters, to get things going add_filter('the_content', 'Wp_UCanHide');
Comments will be moderated and
rel="nofollow"
will be added to all links. You can wrap your coding with[code][/code]
to make use of built-in syntax highlighter.