Wordpress - Hide a block of a post from guest and bots/spiders

Status
Not open for further replies.

vietuploaders

Active Member
160
2010
16
0
Hi Guys,

I'm creating a blog so I just wanna ask you guys if there is any plugins/shortcodes to hide a specific block from guest (unregistered users) and search engine bots.

For example, [hide]content to hide[/hide] , contents in those tags won't be index by search engine, and only registered/logged in users can view those blocks.

Please advise! Thanks in advance!

---------- Post added 4th Dec 2012 at 02:13 PM ---------- Previous post was 3rd Dec 2012 at 04:39 PM ----------

Can't anyone help me with this :(
 
5 comments
Finally found a solution for this, using this plugin for wordpress ;) They have shortcodes that can perform when you make new posts.

Code:
http://wordpress.org/extend/plugins/members/

Hope I helped someone.
 
Add this to your functions.php file:
add_shortcode( 'member', 'member_check_shortcode' );
function member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return 'Sorry, but you have to be a registered member to view this content.';
}

Then, when making a post, wrap the content you wanna hide with [member][/member], it'll be something like this:

[member]Super awesome premium content for members only[/member]
 
Status
Not open for further replies.
Back
Top