How to ‘Hide’ sections of your blog to non login readers

How To: Restrict sections of your blog to non login readers.

Sometimes, there are portions of site that may not suitable for the random public.
Now, there’s a cool trick to hide part of your article but still can be seen by a member who is “logged-in”! Don’t be confused though; this trick does not hide the whole article but only portions that you want.

Changing the WordPress core files can be a real hassle, and really should be left alone to a expert user. So we should avoid that nightmare, and take advantage of function.php instead.

Functions.php is a useful thing from WordPress template file. This file can be used as a way to add
your own functions to WordPress themes just like a plugin to your theme. If you don’t find function.php in your theme folder, you can just create it from a blank file.

below is the script you can add to your function.php

code How to Hide sections of your blog to non login readers

After that, enter the following tag code [hide] to the section that you want to hide.

Examples like this: [hide] section or paragraph you want to hide [/ hide]

hide1 How to Hide sections of your blog to non login readers
Anything inside [hide] and [/hide] will not visible to public, so you can safely hide any sensitive content from public.

What the reader that is ‘logged in’ will see…

logged in How to Hide sections of your blog to non login readers

And what a reader that is logged out will see…

logout How to Hide sections of your blog to non login readers

And if you don’t want to hide a fraction of your content but rather the entire article or blog, WordPress has a nice and simple plugin for this!

http://wordpress.org/extend/plugins/force-user-login/

This plugin forces users to login before viewing any content. The installation is very easy and doesn’t need any detail configuration.

Incoming search terms for the article: