feat(patterns): use author profile block in author bio patterns#424
Open
rbcorrales wants to merge 1 commit intotrunkfrom
Open
feat(patterns): use author profile block in author bio patterns#424rbcorrales wants to merge 1 commit intotrunkfrom
rbcorrales wants to merge 1 commit intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the theme’s Author Bio block patterns to prefer the newspack-blocks/author-profile block (using the compact and avatar-left variations) when that block is registered, while preserving the existing core-block markup as a fallback when it isn’t.
Changes:
- Add conditional rendering in author bio patterns to use
newspack-blocks/author-profilewhen available. - Keep a PHP fallback to existing core blocks (
core/avatar,core/post-author-name,core/post-author-biography) when the Author Profile block isn’t registered. - Update pattern metadata (
Block Types) to includenewspack-blocks/author-profile.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| patterns/author-bio/author-bio.php | Uses Author Profile block variation compact when registered; otherwise falls back to core author name + biography blocks. |
| patterns/author-bio/author-bio-avatar.php | Uses Author Profile block variation avatar-left when registered; otherwise falls back to core avatar + author name + biography blocks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
All Submissions:
Changes proposed in this Pull Request:
Updates the author bio patterns (
author-bioandauthor-bio-avatar) to use the Author Profile block with layout variations whennewspack-blocksis available. The patterns set only thevariationattribute (avatar-leftorcompact) and rely on the block's JS auto-populate logic to fill inner blocks from the variation template, keeping pattern markup minimal. Falls back to the existing core blocks (avatar, post-author-name, post-author-biography) when the Author Profile block is not registered.Closes NPPD-1221.
Feedback required: Since
newspack-blocksis always expected to be active on Newspack sites, is the PHP fallback to core blocks necessary? Two options to consider:parts/post-footer.html, since the patterns are essentially thin wrappers (separators + the block) at this point.How to test the changes in this Pull Request:
newspack-blocksactive.avatar-leftvariation with all fields (name, job title, role, employer, bio, archive link, social links) in a two-column layout.compactvariation with all fields in a vertical stack layout.variation: "avatar-left"orvariation: "compact",layoutVersion: 2, andisContextual: true.newspack-blocksand verify the patterns fall back to core blocks (avatar, post-author-name, post-author-biography).newspack-block-theme/author-bioviawp:pattern.Other information: