I’d like to pull in profile info (name, web address, etc. + some custom-made fields) for specific users onto some of my category pages.
I realize I can pull in profile info using “current author,” but this won’t help in this case because the user won’t be associated with the category page as an author.
For example, I’d like to be able to do the following.
On the Category A page I’d like to put User-John’s profile information (but User-John isn’t an author for any of the posts in Category A).
On the Category B page I’d like to put User-Bob’s profile information (but User-Bob isn’t an author for any of the posts in Category B).
But I will need to do this for hundreds or thousands, so I need a at least a somewhat automated way. I thought of using the Category Description box, but it doesn’t seem to accept PHP (I’ve gotten it to accept HTML and even shortcodes).
Any ideas? … Thanks in advance.
Add a metabox to the category edit screen with a user dropdown. Save the user ID as meta data.
In your category template use the meta user ID as argument for
get_user_by()
:See this post for an example how to get and use the author data.
You can get logged in user’s profile using this global variable :
You need to write code into category templates(category.php & archive.php)