• Resolved njfrese

    (@njfrese)


    I created a custom field called “title” and I would like to add the author’s title to the meta info at the top of each post (content-post-meta.php). How do I do that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    All custom fields are stored as user meta, so you can retrieve the value with get_user_meta().

    Also, you could use the field shortcode [wpmem_field name_of_field]

    Thread Starter njfrese

    (@njfrese)

    I added the following code to the content-post-meta.php file:

    <?php get_user_meta(); ?>

    I get nothing back. Also tried:

    <?php echo get_user_meta(); ?>

    Still nothing. I know I gotta be doing something wrong, but I can’t figure it out. I tried the example code and DID get the user’s last name. But the custom field that I created, called title, I cannot seem to access.

    • This reply was modified 9 years, 7 months ago by njfrese.
    Thread Starter njfrese

    (@njfrese)

    Ok, I finally did figure out where I was going wrong. Now, how to I get the User ID of the author so I can grab his specific title? I got it to work by hard-coding the user ID.

    Plugin Author Chad Butler

    (@cbutlerjr)

    That’s more of a WordPress question than a plugin question; but… there are a lot of different ways (and it depends somewhat on if you are in the Loop or not). Probably the most straightforward in the Loop would be:

    $author_id = $post->post_author;

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding Author Custom Field’ is closed to new replies.