Technical Articles

Showing content to users who are logged in (and who are not logged in) to WordPress

By | Technical Articles

We recently needed a simple way to show content to users who weren’t logged into a client website. Initially, we used this shortcode which works very well. But then we needed to show an alternate text if the user wasn’t logged in. To accomplish this, we adapted the shortcode as follows:To add this to your website, we recommend following these steps: Use a child theme In your child theme’s root folder, make a folder called “includes” In the “includes” folder, make a file called “add-shortcode-if-user-is-logged-in.php” Paste the above code into that file In your child theme’s root folder, make a…

Read More

Recent Posts