March 2020
Beginner
660 pages
18h 28m
English
Similar to the previous scenario, we used the the_content filter. However, this time, we used it for a different purpose: showing user-specific content instead of template-specific content. Consider the following code inside the the_content filter:
if( is_user_logged_in() ){ $content .= "<p>Additional Content for members </p>";}
In this case, we used the is_user_logged_in conditional tag to check whether the user is logged into the site or accessing the site as a guest. If the function returns success, we display the member-specific content.
Read now
Unlock full access