Create Private Content With WordPress Shortcode

Login Manager Lock

As WordPress is used most of the time for blogs, it is possible to make WordPress into a members only website. This can be as private members or for a paying membership website. You can even provide free content and also provide premium content. Hoping that the free content will encourage the visitors to pay for the rest of the content.

For example on this site I could provide a demo of application and instead of providing the code as I do now I could say the code is only available to members.

Members will have to login to my site to see this premium content.

In WordPress it is possible to block content from users who aren't logged in by a simple shortcode.

Code the following into your functions.php page to create the shortcode.

function paulund_check_user_sc( $at, $content = null ) {
	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) {
		return $content;
         } else {
                return '';
         }
}
add_shortcode( 'user_only', 'paulund_check_user_sc' );

Then when you want to block content for users who have logged in you can simply use this shortcode.

[user_only]This content can only be seen by logged in users[/user_only]

Membership Site

If you want to create a membership site obviously this option wouldn't be a full practical model to use. There are plugins to use for a membership site. You will want to get a premium plugin because it will give you full functionality in your switch to a membership site.

I recommend using the following plugin from JigoWatt.

WordPress Premium Content

WordPress Premium Content

Jigowatt’s WordPress Premium Content plugin allows you to easily set up a web site with content which is only accessible to users registered with an active PayPal subscription. You can easily manage your subscribers, change subscription prices and set up custom membership renewal options (annual, bi-annual or just month by month).

Your premium content can be split into as many tiers as you like, allowing for easy creation of “Gold”, “Silver” and “Bronze” memberships, each of which given access to different levels of your premium content.

The plugin includes a front-end subscription page with built in registration and there is IP based security to prevent subscription sharing.

  • Take payments via PayPal (optionally makes use of the PayPal IPN )
  • Auto-renew subscriptions or just one-off payments
  • Give posts premium status and a content level (for tiered access to content)
  • Hide entire posts via an easy to use write panel
  • Hide parts of posts using a [premium] shortcode
  • Front-end Subscription page with user registration built in – easily customisable with a new template page in your theme
  • IP Based security to prevent users logging in at the same time and sharing a subscription
  • Admin section for managing subscribers, membership packs, and plugin settings.

Get Your Copy

Advertise here 50% Off

Comment