• 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

Hide comments from non 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 › Design Tips and Tricks › Hide comments from non users?

This topic is: resolved

Tagged: comments, hide comments

  • This topic has 6 replies, 2 voices, and was last updated 13 years, 3 months ago by Brad Dalton.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • April 18, 2013 at 9:24 pm #36290
    jkstech
    Member

    Seeing as there is no single page or single content template for the News theme, where can I add code to require users to be logged in to see comments?

    I know how to require login to comment, but on my previous theme I was able to set it so comments were hidden unless you were logged in.

    I don't see where I can do that in the Genesis/News setup. Would this be something to add to the functions as a filter of some sort?

    http://maschinetutorials.com
    April 18, 2013 at 10:29 pm #36309
    Brad Dalton
    Participant

    Please paste the code here and i will test it for you. Thanks

    Generally it goes in the child themes functions.php file.


    Tutorials for StudioPress Themes.

    April 18, 2013 at 10:59 pm #36313
    jkstech
    Member

    I'm not sure what code to actually use at this point, I'm new to the framework previously I was using a different framework where the child themes actually had single.php and page.php files

    April 18, 2013 at 11:05 pm #36316
    Brad Dalton
    Participant

    Wrote this for you and tested in on the Back Country child theme.

    Code not displaying? Grab it from Github Gists

    That's why Genesis is so good because you use the child themes functions.php for all your PHP customization and never have to worry about finding or losing it.


    Tutorials for StudioPress Themes.

    April 18, 2013 at 11:10 pm #36318
    jkstech
    Member

    Awesome, that worked perfectly, thanks!! 🙂

    Any way to add a messages that says "you must be logged in to view comments" ?

     

    April 19, 2013 at 12:33 am #36326
    Brad Dalton
    Participant

    Wouldn't be hard to echo some text and HTML.

    http://my.studiopress.com/snippets/


    Tutorials for StudioPress Themes.

    April 21, 2013 at 3:21 am #36661
    Brad Dalton
    Participant

    There's lots of different ways you can do this:

    Here's one method:

    You can also remove the logout link, redirect to a specific url after login or use another tag for loginout.

    <?php wp_loginout(); ?>
    

    Learn more http://codex.wordpress.org/Function_Reference/wp_loginout


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Hide comments from non users?’ 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