ButlerBlog

chad butler's weblog

  • About
  • Blog
  • WordPress Plugins
  • Contact
Home / Web / WordPress / WP-Members / Blocking content in a custom template

Blocking content in a custom template

By Chad Butler 2 Comments

Lately, this question has come up a lot.  How do you block content that is outside the loop and still display the login/registration forms on the page.

This type of issue may come up if you are using a custom query to put some specific content on a specific page, or it might be that you are displaying specific data that you want to protect.  As long as it is something in the WordPress template framework, you can still use WP-Members to block the content. 

There are some key WordPress concepts that I would suggest you be familiar with before I explain this.

First, understand the WordPress Loop and how to recognize it.  WP-Members specifically uses the Loop in blocking content.  The custom template method we are discussing here occurs when the Loop is not there, so you need to be able to recognize that fact.

Next, you should understand how page templates work.  Be able to recognize if the template you are using has the Loop or not.  If it does have an instance of the Loop, then this method of blocking content will likely not be necessary.  If, however, this template is using something custom outside or without the Loop, then this does apply.

Lastly, you need to know how to use the WordPress native function is_user_logged_in(). This function returns true if the user is logged in.  We will be using this as a conditional statement in the custom template to determine what to display to the user.

Next page: Putting it all together

Enjoyed this article?

Don't miss a single post. Subscribe to our RSS feed!

  • Facebook
  • Twitter
  • Email
  • Print
  • More
  • LinkedIn
  • Reddit
  • Tumblr
  • Pocket
  • Pinterest
Pages: 1 2

Filed Under: WP-Members Tagged With: development, plugins, tips, WP-Members

About Chad Butler

Chad Butler is a freelance writer and web developer. He has developed several popular WordPress plugins and has written for forbes.com, sfomag.com, and investopedia.com. He also runs a small organic farm in east Georgia.

Join Us!

I will never share your information. No spam. No junk. No kidding. Unsubscribe anytime.

Recent Posts:

  • YouTube Success: Key Tips for Enhancing Video Optimization and Visibility
  • Mobile App vs. Mobile Website Ideal Choice for your Business
  • Top Strategies to Boost Your Brand’s Visibility and Impact
  • Advanced Blogging Strategies: Using Analytics, A/B Testing, and Conversion Optimization Techniques to Grow Your Audience
  • Unlock Real-Time Process Insights to Save Time and Money
  • How Writers Can Attract More Audience Attention
  • Dress for Success – Even at Home
  • Mastering the Art of Crafting SMART Marketing Goals
  • Rediscover Your Brand Story: 7 Tips for Refreshing Your Company Identity
  • Creating Engaging Content: Tips for a Successful Content Marketing Strategy

Archives

  • About
  • Blog
  • Archive
  • Contact

Site powered by WordPress, running on the Genesis Framework from StudioPress.

Unless otherwise noted, content on this site is © 2006-2025 ButlerBlog and may not be reproduced without express written permission from the author.

Some content may include affiliate links for which this site receives a small commission.