So I am currently running a multisite install where the super admin creates all new sites. One of the templates we’re using has a blog page for a loan officer. I am extending the user profile so the new user can input critical data that needs to be displayed on their page. There is only one user per site, in addition to the Super Admin that is automatically added when a site is created. What I have come to find, is that you need to specify the user ID if you want to use the function
outside of the loop. Here’s my problem. I can’t put an ID in the template, because each new loan officer will use this same theme template. So how can I make these fields dynamic? Below is an image of the profile section for the LO to help visually. Another example is that Andy Johnson will be the user of the blog with a role of author. The next site we create will be for Jack Smith. And his blog will need to reflect the relevant information that is put in his profile page.
EDIT: I tried using get_current_user() as well but with no luck of fetching a specific user. It just pulls the Super Admin. I keep finding snippets that say they should work, but everything seems to output the Super Admin.
EDIT: It seems as though getting the $user_id from the global post results in the Super Admin as well. Does anyway know if I should be using the WP_Users_Query?
Not sure how this would differ with multi-site, but this is how you’d do this outside the loop normally:
<?php # get post data $temp_post = get_post($post_id); # grab the author meta $user_id = $temp_post->post_author; # grab the field you're looking for $first_name = get_the_author_meta('first_name',$user_id); # display field echo $first_name; ?>