I want to enter some information on each author’s archive. I know there is the author description but that’s just some unformatted block of text. I would like to be able to use the block editor to have something more substantial. I see that there is no element conditional for a single author. What’s the best way to do it?
The solution I found was to create as many block elements as authors, assign them in a certain hook and use the generate_element_display filter to conditionally display them to their respective authors. Seems kind of clunky and not user-friendly, though…
Hi Ying. I don’t want to create an author box (I am aware of how this is done). I want to create single author pages. The ones that appear when you click on an author’s link. Right now the default functionality is that each author has an archive of posts and I can also inject the description through a hook and a GP dynamic content block. I am after a more elegant way where I would be able to inject block information into each author’s content.
Another solution I thought of was to redirect each author to a static page but it still feels like a hack. Was wondering if there was something else I could do? More in line with the GP templating system.
Well, you’re correct. You would need to use generate_element_display to achieve as such.
To clarify, will the structure/layout of the Elements be different for specific authors or just roles? (If it’s just roles, it can be set in the Display Rule location as well.)
Perhaps we can assist you a bit with your conditional statement if it’s with different authors.
It’s for different authors. Each author needs to have a bio and some content. I can handle the author’s conditional, the article is pretty explanatory.