• Hi

    I love this plugin and find it super useful. I’m trying to show a message “please login….” to everybody who is logged out. I don’t want logged in users seeing this message.

    “[is_user_logged_in]This content is only shown to logged-in users.[/is_user_logged_in]”

    Does the oppposite. I want to do:
    [!is_user_logged_in]This content is only shown to logged-in users.[/!is_user_logged_in]

    What’s the best way of doing this?

    I’ve also tried:
    [access role=””]Content Here[/access]
    But that just shows it to nobody.

    Any ideas on how to do this?

    https://wordpress.org/plugins/members/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m currently looking into the same thing. The plugin only seems to hide the content with the [access] shortcode when applied to template files and doesn’t display the error message.

    So my workaround I was looking to do was:

    <?php if ( !current_user_can( 'read_pages ' ) ) { ?>
                Error message here.
    <?php } ?>

    This could probably work for you if you are putting it in a template file.

    Thread Starter Lab41

    (@lab41)

    Could I put that code in my theme functions.php? Or do I need an exec php plugin? I’d prefer to avoid the extra plugin route if possible.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Content To LOGGED OUT Users’ is closed to new replies.