Repository navigation
Add author archive template and post author box (4.11.0) - #115
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Author archives had no template of their own, and single posts showed the author as plain text with no link and no bio, so the profile fields were never displayed.
templates/author.htmlwith the newelayne/template-author-archivepattern: avatar, name and profile biography above the post grid. An empty biography renders no empty paragraph.elayne/authorBlock Bindings source (inc/author-bindings.php) exposes the archive author's name, biography and avatar URL to core heading, paragraph and image blocks. Patterns are evaluated before the main query is resolved, soget_queried_object()is empty in a pattern file (first attempt, a PHP-in-pattern header, rendered an empty name). Bindings resolve at render time.elayne/post-author-boxpattern: round avatar, author name linked to the archive, biography, "Written by" label. Added above the tags in all four single-post layouts.style.css,readme.txt,package.json,package-lock.json,CHANGELOG.md).Why
Found on aseonomics.com, where six authors had empty profiles and posts did not link to their author pages. A site-level database template override covers it there today. This moves it into the theme so every Elayne site gets it.
Tested
On the local demo site (
demo.imagewize.test, theme synced from this branch):/?author=1renders the avatar and name from the binding. With a biography set the paragraph renders; with an empty one it is removed.php -lclean on all new files.phpcsreports only the missing@packagetag that existing patterns also report.Not run: Sentinel runtime validation of the new patterns (editor block validation, in particular the bound image block), and a check at mobile width.
Notes
singleorauthorin the Site Editor keep their own version, so the new box and byline link only appear where the theme templates are in use.