• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Category only for logged in users

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Category only for logged in users

This topic is: not resolved

Tagged: category, protected

  • This topic has 4 replies, 2 voices, and was last updated 12 years, 9 months ago by Heinz.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • September 26, 2013 at 1:30 am #64256
    Heinz
    Member

    Hi forum,

    we use a member-plugin to present protected posts to logged-in users only. But we want to hide also a complete category. Logged-in users should be able to see the category with the list of recent posts, others should see the login form instead.

    We think about creating a category.php file, and remove the genesis_do_loop() for anonymous users for this protected category. How can we then place the login form there? Hard-coding in that category.php file?

    Thank you in advance,
    Heinz


    Online-Marketing Agentur E-Werkstatt

    September 26, 2013 at 1:56 am #64258
    Brad Dalton
    Participant

    Which membership plugin are you using?

    Here's a post which includes 5 ways to remove posts in specific categories from displaying. http://wpsites.net/web-design/exclude-category-posts-page/


    Tutorials for StudioPress Themes.

    September 26, 2013 at 2:08 am #64260
    Heinz
    Member

    Hi Brad,

    in that case wp-members. But we do not use it for lock/unlock of posts, but for user handling only. The authors should not be forced to use a custom field. When they post into a certain category, the posts should be automatically protected, including the whole list of posts of that category.

    The question really is: how can I show the entire list of posts of a specific category to logged-in users only, and present a form to all others (using Genesis; and for the category itself, i.e. without using a category page template).

    Heinz


    Online-Marketing Agentur E-Werkstatt

    September 26, 2013 at 12:05 pm #64312
    Brad Dalton
    Participant

    I would use a plugin like s2members or members by Justin Tadlock. Both plugins enable you to do hide posts in specific categories.

    s2Member allows you to protect Pages, Posts, Tags, Categories. This is the best members plugin in my opinion.


    Tutorials for StudioPress Themes.

    September 27, 2013 at 3:48 am #64442
    Heinz
    Member

    I once installed S2members, but decided to not use it for simple cases. It left a mess when I deinstalled it again.

    Anyway, my question is not about how to handle registered users (this is already well handled by plugins like "members" oder "wp-members"), but about how to show a whole category only to logged in users, and provide other users some text or a form instead.

    So it must be something like:

    Creation of a file category.php
    and then:

    <?php
    if ( is_category(12) || is_category(27) ) { 
    	if ( !is_user_logged_in() ) 	
    		remove_action('genesis_loop', 'genesis_do_loop');
    	} else {
    		echo '<h2>Member Area</h2>';
    		echo '<p>Please log in.</p>';
    		// login form here
    	}
    }
    genesis();
    ?>

    Essentially this works, but the else-part misses a lot of structuring HTML-elements. Of course these can be added manually with echo-statements, but maybe we could remove something else than the whole loop?


    Online-Marketing Agentur E-Werkstatt

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble