Skip to content
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

feat: add a filter on term classes so other plugins can add classes #872

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Sep 17, 2021

All Submissions:

Changes proposed in this Pull Request:

A small feature which shouldn't affect any plugin behavior. Adds a filter for the term class names that are added to each post displayed in Homepage Posts and Post Carousel blocks. This will let other plugins hook into the filter and add arbitrary class names as needed. The specific use case I added this for is featured listings, but it might come in handy for other purposes as well.

How to test the changes in this Pull Request:

  1. Check out this branch.
  2. Somewhere in your theme's functions.php, temporarily add a callback for the new filter:
function newspack_test_term_classes_filter( $classes ) {
	$classes[] = 'my-arbitrary-class';
	return $classes;
}
add_filter( 'newspack_blocks_term_classes', 'newspack_test_term_classes_filter' );
  1. Add a Homepage Posts and Post Carousel block to a post and view on the front-end. Confirm that your arbitrary class name is added to each article item in both blocks.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added enhancement New feature or request [Status] Needs Review labels Sep 17, 2021
@dkoo dkoo requested review from laurelfulford and a team September 17, 2021 17:21
@dkoo dkoo self-assigned this Sep 17, 2021
@dkoo dkoo merged commit 28c0fde into master Sep 21, 2021
@dkoo dkoo deleted the feat/term-class-filter branch September 21, 2021 16:42
matticbot pushed a commit that referenced this pull request Sep 21, 2021
# [1.38.0-alpha.1](v1.37.1...v1.38.0-alpha.1) (2021-09-21)

### Features

* add a filter on terms so other plugins can add classes ([#872](#872)) ([28c0fde](28c0fde))
* allow some html in the homepage posts subtitle ([#869](#869)) ([82cea66](82cea66))
* disable Jetpack donations when using Newspack donations ([#875](#875)) ([54ad5b7](54ad5b7))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.38.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Sep 21, 2021
# [1.38.0](v1.37.1...v1.38.0) (2021-09-21)

### Features

* add a filter on terms so other plugins can add classes ([#872](#872)) ([28c0fde](28c0fde))
* allow some html in the homepage posts subtitle ([#869](#869)) ([82cea66](82cea66))
* disable Jetpack donations when using Newspack donations ([#875](#875)) ([54ad5b7](54ad5b7))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.38.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants