Conversation
The `is_archive()` function doesn't accept any parameters, so it's returning `true` for any archive view.
WalkthroughThe changes update archive detection logic in the template loader class. Specifically, the detection for event category archives is changed from generic archive detection to taxonomy-specific detection, and the detection for event date archives is changed from generic archives to post type archive detection. These modifications refine how the template system identifies and handles different types of event-related archive pages. Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/classes/class-se-template-loader.php (1)
74-76: Critical: Early return blocks 'se-event-date' handling.Line 74's early return only checks for 'se-event' post type, but the code below (lines 83-104 and 108-120) also handles 'se-event-date' content. This means singular 'se-event-date' posts and 'se-event-date' post type archives will return early with the default template, preventing the custom template logic from executing.
Apply this diff to allow 'se-event-date' content through:
- if ( ! is_singular( 'se-event' ) && ! is_post_type_archive( 'se-event' ) ) { + if ( ! is_singular( array( 'se-event', 'se-event-date' ) ) && ! is_post_type_archive( array( 'se-event', 'se-event-date' ) ) ) { return $template; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/classes/class-se-template-loader.php(2 hunks)
🔇 Additional comments (1)
src/classes/class-se-template-loader.php (1)
59-59: Correct fix for taxonomy archive detection.The change from
is_archive('se-event-category')tois_tax('se-event-category')is correct. Theis_archive()function doesn't accept parameters, so the old code was always returning true for any archive page. Usingis_tax()properly targets the specific taxonomy archive.
| // Determine if standard se-event archive templates are available in the theme | ||
| // before replacing with the custom template in this plugin. | ||
| if ( is_archive( 'se-event-date' ) ) { | ||
| if ( is_post_type_archive( 'se-event-date' ) ) { |
There was a problem hiding this comment.
Correct fix for post type archive detection.
The change from is_archive('se-event-date') to is_post_type_archive('se-event-date') is correct. However, this code will not execute due to the early return at line 74 blocking 'se-event-date' content.
🤖 Prompt for AI Agents
In src/classes/class-se-template-loader.php around lines 74 and 108, the new
is_post_type_archive('se-event-date') check at line 108 is correct but never
reached because the early return at line 74 exits for the same requests; update
the early return so it does not short-circuit se-event-date requests.
Concretely, modify the condition at line 74 to exclude se-event-date (or add an
explicit exception) — i.e., only return early when the request is not a
se-event-date post type/archive (use is_post_type_archive('se-event-date')
and/or is_singular('se-event-date') to gate the exception) so the subsequent
is_post_type_archive('se-event-date') branch can execute.
Changes proposed in this Pull Request
is_archive( 'se-event-category' )withis_tax( 'se-event-category' ), andis_archive( 'se-event-date' )withis_post_type_archive( 'se-event-date' ).The
is_archive()function doesn't accept any parameters, so it's returningtruefor any archive view.Mentions https://github.com/a8cteam51/bfi/issues/812
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.