feat(yoast): use shared primary category utility from newspack-plugin#2655
feat(yoast): use shared primary category utility from newspack-plugin#2655rbcorrales merged 1 commit intotrunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the classic Newspack theme’s Yoast primary category handling to use the shared Newspack\Primary_Category utility provided by newspack-plugin, and removes the now-relocated Customizer toggle.
Changes:
- Updated
newspack_categories()to useNewspack\Primary_Category::get()when available, falling back to the standard category list otherwise. - Updated
newspack_body_classes()to add theprimary-cat-*class using the shared utility when available. - Removed the legacy
post_primary_categoryCustomizer setting/control.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
newspack-theme/inc/template-tags.php |
Uses Newspack\Primary_Category when available; otherwise falls back to get_the_category_list(). |
newspack-theme/inc/template-functions.php |
Computes primary-cat-* body class via the shared utility when available. |
newspack-theme/inc/customizer.php |
Removes the old Customizer toggle for Yoast primary category behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
laurelfulford
left a comment
There was a problem hiding this comment.
Looks good! That Customizer panel is getting empty!
|
Hey @rbcorrales, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
# [2.21.0-alpha.1](v2.20.2...v2.21.0-alpha.1) (2026-04-02) ### Bug Fixes * **layout:** prevent horizontal scrollbar on full-bleed image positions ([#2667](#2667)) ([c92383b](c92383b)) * **post-date:** move hook inside posted_on for markup preservation ([#2658](#2658)) ([fe6725a](fe6725a)) ### Features * **yoast:** use shared primary category utility from newspack-plugin ([#2655](#2655)) ([21908d7](21908d7))
|
🎉 This PR is included in version 2.21.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [2.21.0](v2.20.3...v2.21.0) (2026-04-13) ### Bug Fixes * **layout:** prevent horizontal scrollbar on full-bleed image positions ([#2667](#2667)) ([c92383b](c92383b)) * **post-date:** move hook inside posted_on for markup preservation ([#2658](#2658)) ([fe6725a](fe6725a)) ### Features * **yoast:** use shared primary category utility from newspack-plugin ([#2655](#2655)) ([21908d7](21908d7))
|
🎉 This PR is included in version 2.21.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Replaces inline Yoast
WPSEO_Primary_Termlogic in the classic theme with the sharedNewspack\Primary_Categoryutility from newspack-plugin (see Automattic/newspack-plugin#4563).Changes:
newspack_categories()intemplate-tags.phpnow calls the shared utility with aclass_existsguard, falling back to all categories when the plugin is not activetemplate-functions.phpuses the shared utility for theprimary-cat-*classpost_primary_categoryCustomizer toggle (the setting now lives in Newspack > Settings > Advanced Settings)The plugin handles backwards compatibility: sites that had the old Customizer toggle disabled will remain disabled until an admin explicitly changes it via the new settings UI, at which point the legacy theme mod is cleaned up.
Depends on Automattic/newspack-plugin#4563.
Closes NPPD-1346.
How to test the changes in this Pull Request:
Other information: