Skip to content

Conversation

@dotjon
Copy link

@dotjon dotjon commented Oct 9, 2025

This pull request introduces a new Announcements feature to the plugin, including announcement post type support, block rendering, and a flexible rule-based system for displaying announcements. The changes add core classes for managing, rendering, and determining the visibility of announcements, as well as registering the necessary block types and meta definitions.

Announcements Feature Implementation

  • Added Announcement_Controller to manage fetching and filtering announcements based on a set of rules (placement, front page, page visibility, scheduling).
  • Introduced a rule-based system for announcements, including Placement_Rule, Front_Page_Rule, Page_Visibility_Rule, and Scheduling_Rule, all implementing a shared Rule_Interface. [1] [2] [3] [4] [5]

Rendering and Block Registration

  • Added Announcement_Renderer to render announcements as block markup and HTML, supporting placement and context-based rendering.
  • Registered the new block type tribe/announcement-renderer in the block definer.

Meta and Post Type Integration

  • Registered Announcement_Meta in the meta definer for object meta support. [1] [2]
  • Added Announcement_Subscriber to the core post type subscribers for proper initialization.

@dotjon dotjon requested a review from Copilot October 9, 2025 09:50
Copy link
Contributor

Copilot AI left a 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 PR introduces a comprehensive Announcements feature to the plugin, enabling administrators to create, manage, and display announcements across the website with flexible placement and visibility rules.

  • Added announcement post type with meta fields for content, styling, scheduling, and display rules
  • Implemented a rule-based system for controlling where and when announcements are displayed
  • Created block components for rendering announcements in theme templates

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
wp-content/themes/core/parts/header.html Added announcement renderer blocks above and below header
wp-content/themes/core/blocks/tribe/announcements/block.json Formatting cleanup for alignment options
wp-content/themes/core/blocks/tribe/announcement-renderer/* New block for rendering announcements with editor integration
wp-content/plugins/core/src/Post_Types/Announcement/* Announcement post type configuration and class definitions
wp-content/plugins/core/src/Object_Meta/Post_Types/Announcement_Meta.php Comprehensive meta fields for announcement configuration
wp-content/plugins/core/src/Object_Meta/Meta_Definer.php Registration of announcement meta in DI container
wp-content/plugins/core/src/Core.php Added announcement subscriber to core post types
wp-content/plugins/core/src/Components/Announcements/* Rule system and rendering logic for announcements
wp-content/plugins/core/src/Blocks/Blocks_Definer.php Registration of announcement-renderer block type

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dotjon dotjon requested a review from Copilot October 9, 2025 10:37
Copy link
Contributor

Copilot AI left a 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 22 out of 22 changed files in this pull request and generated 5 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@GeoffDusome GeoffDusome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dotjon Can you explain the creation / usage of the additional announcement-renderer block? I see that you're rendering the announcements block inside of the new one but I was just wondering if we could cut out the middle and just use the announcements block as the renderer?

@dotjon
Copy link
Author

dotjon commented Oct 9, 2025

@dotjon Can you explain the creation / usage of the additional announcement-renderer block? I see that you're rendering the announcements block inside of the new one but I was just wondering if we could cut out the middle and just use the announcements block as the renderer?

Sure @GeoffDusome; my initial approach used the announcement block directly but it added a lot of complexity to it.

With the 2 block approach it keeps things singly responsible and means we can manually use the Announcement block without conflicting attributes vs CPT logic; the announcement block stays simple and can be used anywhere.

Copy link
Contributor

@GeoffDusome GeoffDusome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking & working great from my testing. I made a few FE updates:

  • Connected the Announcements block to the attributes
  • Removed style files from the Announcement Renderer block, as they aren't required for now. I'm fine with the Renderer showing in the editor, even if the block is empty, as we need to be able to remove the block if we want a simple way to stop supporting announcements without removing the feature entirely (say, if a client wants it later but not now).

Just need to get the editable attributes onto the Announcements block itself so that the block can be used separately.

Thank you and great work here! 🌮

@dotjon dotjon requested a review from Copilot October 14, 2025 07:37
Copy link
Contributor

Copilot AI left a 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 22 out of 22 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dotjon dotjon added the Launch Environment Deploys to dokku label Oct 14, 2025
@GeoffDusome
Copy link
Contributor

@dotjon I'm realizing now I gave you an impossible task here and that I should have handled the controls for the block. That's my fault. For some reason I thought this was an ACF block. I'm going to work on finalizing what you started here and we'll get this buttoned up for merging!

Copy link
Contributor

@GeoffDusome GeoffDusome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 This is looking great now.

Can you just give a double check of the BE updates I had to make in my most recent commit and then I'd like to get a quick view from @JMRhodes before we merge. Thank you!

$query = new \WP_Query( [
'post_type' => Announcement::NAME,
'post_status' => 'publish',
'posts_per_page' => -1,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set a manageable upper limit here, just as a safe practice.

Copy link

@JMRhodes JMRhodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 just one small adjustment, otherwise looks good 👍

@dotjon dotjon merged commit 0385364 into feature/announcements Oct 17, 2025
7 checks passed
@dotjon dotjon deleted the feature/announcements-be branch October 17, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Launch Environment Deploys to dokku

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants