• 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

Template with Member Only Sidebars

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 › Design Tips and Tricks › Template with Member Only Sidebars

This topic is: not resolved
  • This topic has 9 replies, 3 voices, and was last updated 12 years, 8 months ago by AnitaC.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • October 19, 2013 at 8:43 am #67651
    AnitaC
    Keymaster

    I have a dilemma on my hands. I am using the WP-Members plugin with the Magazine theme, along with the Genesis Simple Sidebars. We've created custom menu items and attached them to the Member Only Sidebar (Primary) and Member Only 2 Sidebar (Secondary Sidebar). The content of the menu items is Member Only Pages. When I click the Member Only tab on the Navigation - the content area say, "You must be a member to view this content. Please log in or Register." However - both of the Member Only sidebars are visible.

    Is there a way to create a template with Member Only sidebars where they will not show up at all until the member logs in or register?


    Need help with customization or troubleshooting? Reach out to me.

    October 19, 2013 at 9:20 am #67657
    Brad Dalton
    Participant

    1. Why don't you add conditional tags to the widgets housing the custom menu's so they only display for logged in members?

    You can use a a plugin Widget Logic or Slim Jetpack.

    2. Another option is to create a new widget area using conditional tags for logged-in and logged out users.

    3. Or you can conditionally remove the primary or secondary nav menu for logged out users.

    4. Or you can conditionally display any menu for logged in or logged out users.


    Tutorials for StudioPress Themes.

    October 19, 2013 at 9:22 am #67658
    AnitaC
    Keymaster

    .....or, or, or.... I can email you!!! LOL! I am NOT that SMART Brad!!! I'll try Widget Logic but 3 or 4 would work perfectly!


    Need help with customization or troubleshooting? Reach out to me.

    October 19, 2013 at 10:28 am #67675
    Sridhar Katakam
    Participant

    Add the following code in functions.php. Study it and make changes as needed.

    //* Register Members only Primary and Secondary sidebars
    
    genesis_register_sidebar( array(
    	'id'          => 'members-primary',
    	'name'        => __( 'Primary Sidebar (Members)', 'metro' ),
    	'description' => __( 'This is the members only primary sidebar.', 'metro' ),
    ) );
    
    genesis_register_sidebar( array(
    	'id'          => 'members-secondary',
    	'name'        => __( 'Secondary Sidebar (Members)', 'metro' ),
    	'description' => __( 'This is the members only secondary sidebar.', 'metro' ),
    ) );
    
    //* Show Members only custom Primary sidebar in Primary Sidebar location
    
    add_action( 'genesis_after_header', 'sk_change_genesis_primary_sidebar' );
    function sk_change_genesis_primary_sidebar() {
    
    	if( is_user_logged_in() && is_active_sidebar( 'members-primary' ) ) {
    
    		// Remove the Primary Sidebar from the Primary Sidebar area.
            remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    
    		add_action( 'genesis_sidebar', 'sk_do_sidebar' );
    	}
    
    }
    
    function sk_do_sidebar() {
    
    	dynamic_sidebar( 'members-primary' );
    
    }
    
    //* Show Members only custom Secondary sidebar in Secondary Sidebar location
    
    add_action( 'genesis_after_header', 'sk_change_genesis_secondary_sidebar' );
    function sk_change_genesis_secondary_sidebar() {
    
    	if( is_user_logged_in() && is_active_sidebar( 'members-secondary' ) ) {
    
    		// Remove the Secondary Sidebar from the Secondary Sidebar area.
            remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
    
    		add_action( 'genesis_sidebar_alt', 'sk_do_sidebar_alt' );
    	}
    
    }
    
    function sk_do_sidebar_alt() {
    
    	dynamic_sidebar( 'members-secondary' );
    
    }

    Genesis Tutorials | Follow me on Twitter

    October 19, 2013 at 10:48 am #67678
    AnitaC
    Keymaster

    Thank you, @sridhar. I'll give it a try.


    Need help with customization or troubleshooting? Reach out to me.

    October 22, 2013 at 12:16 pm #68247
    AnitaC
    Keymaster

    @sridhar, I just had the opportunity to try this on the demo to make sure I could get it to work. I have it working, but when I am logged in, I still get the contents in the Red box - http://awesomescreenshot.com/0f41v2l08a. Is there a way to remove that and have the widget below it show up closer to the top?


    Need help with customization or troubleshooting? Reach out to me.

    October 24, 2013 at 2:08 am #68565
    Sridhar Katakam
    Participant

    That is not supposed to happen because in the code we are asking it to show the custom Members only sidebar in Secondary Sidebar location.

    Can you send me the WP and cPanel/FTP login via http://sridharkatakam.com/contact/ so I can take a look outside?


    Genesis Tutorials | Follow me on Twitter

    October 28, 2013 at 4:48 pm #69537
    AnitaC
    Keymaster

    Ok, sending an email to you now. If I put a blank text widget in that area it disappears though.


    Need help with customization or troubleshooting? Reach out to me.

    October 29, 2013 at 6:28 am #69608
    Sridhar Katakam
    Participant

    It was happening because of Genesis Simple Sidebars being extra "helpful" and showing that friendly widget :D.

    I have deactivated that plugin and that extra widget is now gone.


    Genesis Tutorials | Follow me on Twitter

    October 29, 2013 at 7:09 am #69616
    AnitaC
    Keymaster

    Thanks again!


    Need help with customization or troubleshooting? Reach out to me.

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Template with Member Only Sidebars’ is closed to new 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