Support » Developing with WordPress » Block Theme Author Template

  • I’m feeling pretty dumb right now.

    I just want to build an author template, like I’ve been doing for over a decade now, but I want to do it in a block theme. In the past I’d get the author meta using the author ID, but I can’t get that in the template file. I can’t even string together the proper words to find a solution in a search engine.

    Is there something like this (https://codex.wordpress.org/Author_Templates) but for block themes?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    Thread Starter justin.garner23

    (@justingarner23)

    Thanks for the quick response @t-p!

    How does one go about adding author meta, though? I didn’t see anything about accessing any of the other meta users add to their profile that we’ve traditionally been able to add to author templates, like outlined here: https://codex.wordpress.org/Author_Templates#Using_Author_Information

    Moderator bcworkz

    (@bcworkz)

    How does one go about adding author meta?

    Do you mean adding custom meta data via the user’s profile screen?

    While block editor content uses a very different paradigm than the classic editor did, the user profile screen remains much as it has been for years. The profile screen’s PHP code has a number of action hooks you can use to output additional form fields. Then use one of the action or filter hooks that fire when user data is inserted or updated to validate, sanitize, and save your added meta data.

    For example, use the ‘personal_options’ action to output additional form fields. Then use the ‘insert_user_meta’ filter to add your custom values to what WP will save as user meta data.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.