Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Could you explain more abotu why you would want to do this? It's not clear how you're planning to 'associate' these people with the categories ( how does it know to show John and not Marys profile data? ). If you can explain what you're trying to do then maybe we can offer alternatives that give the same result, or provide an automated solution –  Tom J Nowell Apr 14 '12 at 21:04
add comment

1 Answer

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():

// First find the ID, put it into $user_id then:
$author = get_user_by( 'id', $user_id );

See this post for an example how to get and use the author data.

share|improve this answer
    
Toscho - I was never notified of this reply, so I didn't realize you had left it. Thanks. –  user15196 May 16 '12 at 17:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.