Add Posts and Replies block for author archives#3035
Open
Add Posts and Replies block for author archives#3035
Conversation
Introduce a new `activitypub/posts-and-replies` block that renders a tabbed interface on author archive pages, similar to Mastodon's profile view. The "Posts" tab excludes replies (posts containing the `activitypub/reply` block) while "Posts & Replies" shows all posts. Uses the Interactivity API for client-side tab switching with both tab contents pre-rendered server-side. Includes ARIA tablist/tab/tabpanel roles with dynamic aria-selected for accessibility. Closes #1213
There was a problem hiding this comment.
Pull request overview
Adds a new activitypub/posts-and-replies block for author archives that provides a Mastodon-like tabbed “Posts” vs “Posts & Replies” view, and updates the Fediverse author archive template to use it.
Changes:
- Introduces a dynamic (PHP-rendered) Posts & Replies block with Interactivity API-powered tab switching.
- Adds editor UI (posts-per-page control) and front-end styles for the new block.
- Registers the new block and swaps the author archive template from
core/queryto the new block.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/posts-and-replies/view.js | Interactivity store and click handler for switching tabs. |
| src/posts-and-replies/style.scss | Styles for tabs, post list, and pagination. |
| src/posts-and-replies/render.php | Server-side rendering + WP_Query logic for both tab contents. |
| src/posts-and-replies/index.js | Block registration entrypoint. |
| src/posts-and-replies/edit.js | Editor inspector control + placeholder UI. |
| src/posts-and-replies/block.json | Block metadata, attributes, interactivity support, assets, render file. |
| includes/class-blocks.php | Registers the block and updates the Fediverse author archive template to use it. |
| build/posts-and-replies/view.js | Built view script module. |
| build/posts-and-replies/view.asset.php | Built asset metadata for view script. |
| build/posts-and-replies/style-index.css | Built front-end CSS. |
| build/posts-and-replies/style-index-rtl.css | Built RTL front-end CSS. |
| build/posts-and-replies/render.php | Built render template (copy of src render). |
| build/posts-and-replies/index.js | Built editor script bundle. |
| build/posts-and-replies/index.asset.php | Built asset metadata for editor script. |
| build/posts-and-replies/block.json | Built block metadata. |
| .github/changelog/3035-from-description | Changelog entry for the new feature. |
You can also share your feedback on Copilot code review. Take the survey.
11 tasks
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Replace hardcoded post list markup with the core/post-template inner blocks pattern. Users can now customize which elements appear per post (title, date, excerpt, featured image, etc.) by adding or removing blocks in the editor. - Editor shows InnerBlocks with a default template of post-title (linked), post-date, and post-excerpt - Server-side rendering loops through query results and renders inner blocks per post, injecting postId/postType context - Falls back to default template when no inner blocks are saved - Removes custom BEM styles in favor of core block stylesheets - Keeps only tab UI styles which are unique to this block
Add phpcs:ignore comments for VariableAnalysis.UndefinedVariable since $block is provided by WordPress to block render.php files.
- Add server-side initial state: is-active class, hidden attribute, and correct aria-selected on tabs so the block works without JS. - Persist active tab in pagination URLs via ap_tab query parameter so navigating pages keeps the selected tab. - Add ARIA keyboard navigation: ArrowLeft/Right cycles tabs, Home/End jump to first/last, with roving tabindex.
jeherve
reviewed
Mar 18, 2026
…chive restriction Move query manipulation (reply exclusion filter, base args, pagination) from render.php into a dedicated Posts_And_Replies class for testability. The block no longer bails on non-author-archive pages, making it usable on any page (e.g. a static home page).
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.
Fixes #1213
Proposed changes:
activitypub/posts-and-repliesblock that renders a tabbed interface on author archive pages, similar to Mastodon's profile view.activitypub/replyblock) while "Posts & Replies" shows all posts.core/query.Other information:
Testing instructions:
npm run env-start.Posts and Repliesblock./author/admin/).activitypub/replyblock (Federated Reply).Changelog entry
Changelog Entry Details
Significance
Type
Message
Add a "Posts and Replies" block for author archives that shows tabs to filter between posts and replies, similar to Mastodon's profile view.