• Block part of a page’s content

    I am using wpbackerry and I want to block part of a page content
    On this same page there is the login form, if the user logs in I want him to have access to the content of this page? I can’t find the solution with wpbackerry, I’ve already used this plugin with other builders without problems.
    I used this code:
    add_action(‘wp_head’,function(){
    if(! is_user_logged_in()){
    ?>

    .loggedin {
    display:none;
    }

    <?php
    }
    });
    But I don’t know which hook to use?
    A little help please?
    THANKS

Viewing 6 replies - 1 through 6 (of 6 total)
  • hello? i replied to this but i don’t see it, and re-entering tells me it’s duplicate, so here it is again:

    rtfm https://rocketgeek.com/plugins/wp-members/docs/shortcodes/

    [wpmem_logged_out]please login to view this content… [wpmem_form login redirect_to=”https://yoursite.com/return-to-this-page/”%5D [/wpmem_logged_out] [wpmem_logged_in]…content u want to hide…[/wpmem_logged_in]

    merely hiding with ‘display:none’ still outputs your protected content, visible to anyone who views source or inspects it in the browser…

    i’m not familiar w/ wpbakery (ftfy;-) but it should have a way to input shortcodes…rtfm;-)

    Plugin Author Chad Butler

    (@cbutlerjr)

    One thing to point out is that the method you are using (setting a class to display:none;) doesn’t really “block” the content. All that does is not display it in the viewport. It would still be in the DOM, which makes it viewable by bots/crawlers/spiders, and anyone with CSS turned off or the savvyness to look at their browser inspector.

    The better way to restrict it is to not load it in the first place, which would be (as airdrummer noted) using the plugin shortcode [wpmem_logged_in]. The documentation for that shortcode is here:

    https://rocketgeek.com/plugins/wp-members/docs/shortcodes/status-shortcodes/

    Thread Starter audrey33770

    (@audrey33770)

    yes except that the shortcode allows you to block content in the same block of text for example. I want to be able to block multiple sections from showing with a theme builder.

    afaik u can use multiple shortcodes on the same page…

    Thread Starter audrey33770

    (@audrey33770)

    I have already used this plugin without any difficulty with other page builders, I think you do not understand what I am explaining or that I am expressing myself badly. in short, I’ll manage.
    THANKS

    @jandembowski: wtf r u talking about?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Block part of a page’s content’ is closed to new replies.