Support » Plugin: Sticky Side Buttons » Visible to logged in users is possible?

  • Resolved aspirenetwork

    (@aspirenetwork)


    Thanks for making this simple yet useful plugin. I just had a query, is it possible to make it visible only for logged in users? or users of special types?

    Thank you for your support.
    Ryan

Viewing 1 replies (of 1 total)
  • Plugin Author Maeve Lander

    (@enigmaweb)

    It’s not a feature built into the plugin, however it could be easily achieved with a little custom code. Wrap the button code in an if statement something like this:

    <?php if ( is_user_logged_in() ) : ?>
        //Code for only logged in users
    <?php endif; ?>

    https://developer.wordpress.org/reference/functions/is_user_logged_in/

    A solution to hide for logged in users could be achieved with just css.

    WordPress adds a body class if the user is logged in. For example:

    <body class=”post-template-default single single-post postid-1 single-format-standard logged-in admin-bar no-customize-support wp-custom-logo”>

    So if you have something you want to hide, you’d use .logged-in as part of the CSS selector.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.