Hello,
is it possible with a js or a bit of code (or simply with CSS), hide the views of the post to those who are not logged in?
Hi,
I think that this can be done with some extra code in the theme files. I think that it can be used this condition -> https://developer.wordpress.org/reference/functions/is_user_logged_in/
Thank you!
Hello Calin,
thanks for your reply. I’m not very familiar with the code. I ask you the courtesy if you can help me. Thank you
Hello,
You can try this custom code from here, this code need to be set in functions.ph, so I recommend to use a child theme and set the code in the functions.ph file from the child theme.
I hope this will help you!
Hello,
thanks for your feedback.
I added the code you pointed out to me at the end of the functions.php file, but it gives me error in WordPress… maybe something is missing?
Hi, I pasted your code at the end of the functions.php file.
That’s it đ
Maybe you set it in the wrong functions.php file
I just tested again and for me is working, I also test it in child theme -> https://i.imgur.com/RCDPZC3.png -> https://i.imgur.com/3tQEDB4.png