• Resolved mcgrelio

    (@mcgrelio)


    Hi,

    first thank you for this cute and smooth piece of software!
    I’m using it on my personal blog where I need to show the content (tex and featured image) of specific post categories only to logged users.

    I’m using the “Is a Post with category” condition which properly restricts access to post content but it’s not working for featured image which are still display.

    Is it possible and how to hide also featured image of post of specific categories just to logged users?

    Regards

Viewing 1 replies (of 1 total)
  • Plugin Support mark l chaves

    (@mlchaves)

    Hey @mcgrelio,

    Sorry for the delay. If you’re using the custom message protection (versus a redirect), you’ll see the featured image because:

    1) Content Control only restricts post-entry content.

    2) Featured post images are part of the post header, not the post-entry content.

    The good news is that you can write custom JavaScript (JS) to hide the post featured image every time there’s a Content Control custom message protection on the page.

    Here’s an example that would work on the Twenty Twenty-One theme.

    
    
    (function() {
    	const elt = document.querySelector('.denial-message-wrapper');
    
            // If there's a Content Control denial message on this page, then
            // hide the featured image.
    	if (elt) { 
                // Notes: Change the selector below to the one your theme uses
                // for post featured images.
        	    document.querySelector('.post-thumbnail').style.display = 'none';
    	}
    })();
    
    

    Your JS should go into the footer of your posts.

    Learn more about adding custom JavaScript to your WordPress site in this guide.

    https://docs.wppopupmaker.com/article/84-getting-started-with-custom-js

    Can you give that a try and let us know how it goes?

    Thanks so much 🙂

Viewing 1 replies (of 1 total)

The topic ‘Featured images’ is closed to new replies.