-
Notifications
You must be signed in to change notification settings - Fork 68
feat: add support for tag labels #2613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for displaying selected tags as labels on posts in the Newspack theme. Tag labels appear before headlines in non-singular contexts (like archive pages) and alongside category labels in singular contexts (individual post pages). The feature integrates with the corresponding newspack-plugin implementation and includes graceful degradation when the plugin is not available.
Key changes:
- Added tag label display logic to template files for singular and archive views
- Created new SCSS styling for tag labels with responsive design considerations
- Implemented PHP shim functions to integrate with the newspack-plugin Tag_Labels class
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/compile-scss.js | Added compilation entry for the new newspack-tag-labels.scss stylesheet |
| newspack-theme/template-parts/header/entry-header.php | Integrated tag label display in post headers for singular views |
| newspack-theme/template-parts/content/content-excerpt.php | Added tag labels to post excerpts in archive contexts |
| newspack-theme/template-parts/content/content-archive.php | Added tag labels to archived content displays |
| newspack-theme/sass/plugins/newspack-tag-labels.scss | Created stylesheet with tag label styling for various contexts |
| newspack-theme/inc/newspack-tag-labels.php | Implemented shim functions for tag label generation, display, and styling |
| newspack-theme/functions.php | Added phpcs ignore directives and loaded tag labels compatibility file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Thanks, @thomasguillot! That makes a lot of sense, and your and @laurelfulford's suggestion on using a contrast color for the text color would complement that perfectly. I'll work up those changes for these tag labels.
What are your thoughts on the positioning of this label? Should we put it on the same line as (say) the |
I'd say same line as the SPONSORED label. It's unlikely a publisher will have a sponsored label AND a tag label. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

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-plugin#4381
See also: Automattic/newspack-blocks#2282
In non-singular context (as part of a Content Loop block, for example), the tag label will show up in front of the headline.In singular context (on the individual post page, for example), the tag label will show up with the category label.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).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:
These instructions will be pretty much identical between these two PRs--if you've tested one, you've tested the other.
Basic operation:
Multiple labels:
Custom label text (flag):
Custom label color:
Other information: