feat: add tag labels support to Content Loop block#2282
Open
jason10lee wants to merge 4 commits intotrunkfrom
Open
feat: add tag labels support to Content Loop block#2282jason10lee wants to merge 4 commits intotrunkfrom
jason10lee wants to merge 4 commits intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for displaying selected tags as labels in the Content Loop block (Homepage Articles block). The feature allows tags to be designated as "labels" that appear above post headlines, with customizable text and colors.
Changes:
- Added backend methods to retrieve and format tag labels for posts
- Integrated tag labels into the REST API response for posts
- Updated the Content Loop block template and editor preview to display tag labels
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| includes/class-newspack-blocks.php | Added three new methods: get_tag_labels(), generate_tag_labels(), and display_tag_labels() to retrieve and render tag labels |
| includes/class-newspack-blocks-api.php | Added newspack_blocks_get_tag_labels() method and integrated tag labels into the posts REST API endpoint |
| src/blocks/homepage-articles/templates/article.php | Updated template to retrieve and display tag labels for each post |
| src/blocks/homepage-articles/edit.tsx | Added rendering logic for tag labels in the block editor preview |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Jan 26, 2026
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:
This PR is one of a set that adds the ability to display selected tags as labels. Changes live in the
feat/tag-labelstopic branch on the newspack-blocks, newspack-plugin, and newspack-theme projects.See also: Automattic/newspack-theme#2613
See also: Automattic/newspack-plugin#4381
Labels will appear above the headline, after any category or sponsorship labels.
By default, the text of the tag label will be the same as the tag name. Optionally, the label text can be customized (e.g., to something shorter and more suitable for use as a label). Additionally, the label color can be customized in the Newspack Theme customizer.
Addresses NPPD-383: "Breaking News" or "Developing" Label.
How to test the changes in this Pull Request:
Basic operation:
Multiple labels:
Custom label text (flag):
Custom label color:
Other information: