Using WordPress Members Plugin in Custom Page Template

I am using the Members plugin for the first time, and it is awesome.

The only downside that I have found thus far is in the documentation.

Below I outline how to use the plugin’s functionality in a custom WordPress page template to restrict the contents to a certain role.

Step 1: Install and activate the plugin.
Step 2: Create a role. In our case, we will call the role, “Staff”.
Step 3: Create a capability for that role. In our case, we will create a capability called, “view_staff_member_pages”.
Step 4: Add a user to the “Staff” role.
Step 5: Insert the following code into your template file:

Login to view this content.';
  }
}
?>

That’s it! I hope this helps.

Posted in

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress consultant, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and then to twitter.com/tobycryns and twitter.com/themightymo

Follow Toby's contributions on Github and WP.org.