Wednesday, May 12, 2021
More

    Latest Posts


    10 Ways to Get More Web Design Clients, Fast!

    Hide a part from your content from non-registred visitors

    - Advertisement -backlink tools

    Trying to get new “members” to his WordPress blog is not always easy. To try to push visitors to register and join your blog, you might resort to drastic measures as to conceal a portion of text.
    Or, another scenario, you might want to reserve a portion of text only to the most loyal visitors: your members. This can be done without a plugin and even here the solution!

    membersonly

    - Advertisement -

    First, copy and paste the following code in your functions.php file (which I repeat must be in the file .php on your WordPress theme):

    add_shortcode( 'membre', 'member_check_shortcode' );
    
    function member_check_shortcode( $atts, $content = null )
    {
    if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
    return $content;
    return '';
    }
    - Advertisement -

    Now, when you write a new article, add the new tag

    [Member] [/ member]
    - Advertisement -

    to show the text only to your blog members.

    - Advertisement -

    Latest Posts




    Don't Miss


    300x250_trinka_tagline

    Stay in touch

    To be updated with all the latest news, offers and special announcements.