Hide posts content but keep Featured image

I'm trying to create a membership website, on the homepage I have featured images and excepts of my posts, if I use the Post protection it will hide the whole post, but what I need is just hiding the content when the post is viewed.

Link protection won't work because I have too many posts, and also Shortcode protection won't either because of the particular nature of the post and how it's created, so what I need is a filter to wrap the post content in the protection shortcode.

  • Rupok
    • Support Ninja

    Hi Abel,

    Thanks for your question. If you need to wrap only the post content part with protection shortcode, then I'll suggest you edit your theme template file and wrap the the_content(); function with M2 shortcodes. As you will be using the shortcode in template files, you will need to use the do_shortcode(); function: https://developer.wordpress.org/reference/functions/do_shortcode/

    An example will be like this:

    <?php echo do_shortcode( '[ms-protect-content id="1"]' . the_content(); . '[/ms-protect-content]' ); ?>

    This should protect the content part and will make the content visible only to the subscribers of Membership Plan ID 1. You will get details about M2 shortcodes by going to your website Dashboard > Membership 2 > Help > Shortcodes section.

    I believe this will help. Please let us know if you have any confusion or any further query or this doesn't work for you. We will be very glad to help further.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.