Viewing 8 posts - 1 through 8 (of 8 total)
The topic ‘[ Resolved ] Check if showing profile page of user’ is closed to new replies.
How can I check (via template functions) if a page is a profile page of a user? I want to manually include the ‘posts by user’ function in a template, but currently on the login page (same template as profile page) it shows all posts (not specifically by a user).
The user needs to be author ofcourse. and you can get the AUTHOR id via get_the_author_meta(‘ID’) in your php 🙂
Test it, and if it returns user ID , then it is fine to use.
Hello! Thanks for your reply! However, when I try to use get_the_author_meta(‘ID’) it retrieves the ID of the logged-in user (that’s me!).
The thing that’s going wrong is this: I have a page ‘profile’ at /profile/. This shows the login screen when not logged-in, and my profile when I am logged-in. Also, it shows a members profile when I go to /profile/membername/. However, when I add the shortcode for ‘postsbyuser’ and go to /profile/ (therefor the login page) it shows all posts, even though it doesn’t show a user.
How can I only see the ‘postsbyuser’ on a page that shows a user?
Hi sanderjansma,
please try this code here:
<?php echo do_shortcode('[userpro template=postsbyuser user=author postsbyuser_num=4]'); ?>
Best regards,
keyhanjun
You are welcome! 😉
Btw please verify your purchase:
Thanks!
Best regards,
keyhanjun
The topic ‘[ Resolved ] Check if showing profile page of user’ is closed to new replies.