diagon-ali
Forum Replies Created
-
Ok so I’ve spent quite a while trying to get this working. I’ve discovered that this
get_the_post_thumbnail($dj->ID, ‘thumbnail’)
is what’s controlling the output of the thumbnail.
So I installed WP User Avatar plugin so I could set an image for a user manually, which works fine.
I then set a variable to see what $dj->ID did:
$tmp = $dj->ID;
Then output $tmp and the result was “292” (no quotes)
I looked in phpmyadmin and this correlates to the “wp_posts” table and is giving the “ID” of that post.
I changed the code to:
get_wp_user_avatar($dj->ID, 96)
…and this gives a blank value because there is no user ID of 292.
In fact, the user ID I’m looking for, for the user who is “on-air” happens to be “3”.
I tried the following:
get_wp_user_avatar(3, 96)
and it worked! It output the user thumbnail.
However, obviously I want to dynamically fetch this user ID and this is where I’m struggling now because my PHP knowledge isn’t quite good enough.
Please can someone help with this? How can I maybe use the wp_posts ID and pull in the user ID from the posts_author value? I’m getting confused here…