Skip to content

Release v2.1 - Template System Refactoring and Field Improvements#101

Merged
krugazul merged 12 commits into
masterfrom
2.0.1-trunk
Dec 20, 2025
Merged

Release v2.1 - Template System Refactoring and Field Improvements#101
krugazul merged 12 commits into
masterfrom
2.0.1-trunk

Conversation

@krugazul

@krugazul krugazul commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Release v2.1 - Template System Refactoring and Field Improvements

Overview

This release introduces significant improvements to the template system, enhanced custom field configurations, and better Tour Operator 2.0 compatibility for the Special Offers plugin.

Changes Summary

🏗️ Template System Overhaul

  • New Template Class: Added LSX_TO_Specials_Templates class for proper block template registration

    • Registered archive-special.html and single-special.html block templates
    • Proper template content loading with fallback support
    • Fixed post type slug for single special offer template from 'tour' to 'special'
  • Template Cleanup: Removed legacy template system

    • Deleted unused class-template-redirects.php (189 lines removed)
    • Removed obsolete gulpfile.js (51 lines removed)
    • Cleaned up outdated template selection logic

🔧 Field Improvements

  • Updated special metabox configurations for better CMB2 integration
  • Added post field support for enhanced content management
  • Fixed travel dates field naming for consistency
  • Updated field titles and descriptions for better user guidance
  • Improved field structure and organization (79 lines refactored in config-special.php)

🎯 Post Type Enhancements

  • Fixed post type labels for clarity
  • Updated post type configuration for better block editor support
  • Improved post type registration consistency

🎨 Assets & Branding

  • Updated plugin assets (banners and icons)
    • Converted all banner images from JPG to PNG format
    • Updated icon-128x128 and icon-256x256 to PNG
    • Refreshed visual branding elements for WordPress.org

🌐 Internationalization

  • Updated language files (.po, .pot) with new strings
  • Improved translation consistency across templates
  • Cleaned up language file formatting (103 lines optimized)

Technical Details

  • Files Changed: 28 files
  • Additions: +252 lines
  • Deletions: -483 lines (net reduction of 231 lines!)
  • Version: Bumped to 2.1

Commit History

  1. 941e144 - Fix post type slug for single special offer template
  2. 6ebc801 - Updating field title
  3. e38a890 - Adding post field support
  4. 0feab12 - Fixing travel dates field name
  5. b44b73f - Updating metaboxes
  6. d8e9fc3 - Fixing post type labels
  7. 3893539 - Adding template selection
  8. c6b366d - Deleting unused template file
  9. 3ab2012 - Updating plugin assets

Key Improvements

  • Cleaner Codebase: Removed 231 net lines while adding functionality
  • Modern Templates: Proper block editor template support
  • Better Organization: Improved class structure and file organization
  • Enhanced Fields: More intuitive custom field configurations
  • Simplified Logic: Removed unnecessary redirect and template complexity

Testing Recommendations

  • Test special offer creation and editing
  • Verify custom field functionality (especially travel dates)
  • Check archive and single page templates render correctly
  • Validate Tour Operator 2.0 integration
  • Test connection fields with tours, accommodations, and destinations
  • Verify template loading on both classic and block themes

Breaking Changes

None - This is a backward-compatible release

Contributors

Related Links


Merge Checklist:

  • All automated tests pass
  • Manual testing completed on multiple themes
  • Changelog updated
  • Version numbers updated in all files
  • Documentation reviewed
  • Translation files updated

Summary by CodeRabbit

  • New Features

    • Adds block templates for Specials (single and archive) for theme-driven layouts.
  • Improvements

    • Renames UI labels to use "Special"/"Specials".
    • Modernises metaboxes and gallery selection UI.
    • Updates translations, changelog and compatibility metadata.
  • Removed

    • Removes template-override redirect behaviour and legacy build tasks.
  • Chores

    • Version bumped to 2.1; plugin tested up to 6.9.

✏️ Tip: You can customize this high-level summary in your review settings.

@krugazul krugazul linked an issue Dec 20, 2025 that may be closed by this pull request
32 tasks
@coderabbitai

coderabbitai Bot commented Dec 20, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Removed the legacy template-redirect class and Gulp build tasks; added a block-template registration class plus two HTML templates; switched metabox fields to pw_multiselect/file_list; adjusted labels and translation entries; bumped package and plugin versions to 2.1 / 2.1.0.

Changes

Cohort / File(s) Summary
Version & Metadata
package.json, to-specials.php, changelog.md, README.txt
Bumped package and plugin versions to 2.1.0/2.1; updated changelog with a 2.1 release entry; updated README stable tag and Tested up to.
Template System
classes/class-template-redirects.php, classes/class-to-specials-templates.php, classes/class-to-specials.php, templates/single-special.html, templates/archive-special.html
Removed entire LSX_TO_Template_Redirects class; added LSX_TO_Specials_Templates class to register block templates (with helper to load template HTML); main class now requires the templates class; added two block template files.
Admin & Metaboxes
classes/class-to-specials-admin.php, includes/metaboxes/config-special.php
Hooked custom_fields into lsx_to_post_custom_fields; changed a field label to translated "Related Specials"; replaced many post_select fields with pw_multiselect; switched galleries to file_list with thumbnail/query_args; reorganised related fields and labels; added PHPCS directive.
Post Type Labels
includes/post-types/config-special.php
Updated post-type label strings: singular renamed to "Special"; "New Specials" → "New Special".
Build System Removal
gulpfile.js, README.md
Removed all Gulp tasks and the WordPress i18n Gulp workflow; removed Gulp badge from README.
Internationalisation
languages/to-specials-en_EN.po, languages/to-specials-en_US.po, languages/to-specials.pot
Version bump to 2.1/2.1.0; removed obsolete Special Type admin strings; added template-related strings (Single Special Offer, Specials Offers Archive, descriptions); updated message references and contexts to reflect new template and taxonomy locations.
Schema / Docs
classes/class-to-specials-schema.php
Minor docblock and docstring updates referencing "Specials" instead of "Review"; no logic changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas to focus review on:
    • classes/class-template-redirects.php — ensure removal doesn't leave hooks/calls elsewhere.
    • classes/class-to-specials-templates.php — verify safe use of register_block_template, correct template content loading and output buffering.
    • classes/class-to-specials.php — confirm require_once ordering and instantiation timing with plugin load.
    • includes/metaboxes/config-special.php — validate UI rendering, saving and backward compatibility after pw_multiselect / file_list changes.
    • Language files — confirm message contexts and references align with updated source locations.

Poem

🐰 I hop through code with a cheeky grin,
Old redirects folded, new templates begin.
Galleries gather in tidy file_list beds,
Labels and texts take fresh little treads.
Gulp hopped away — Specials dance instead. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: version 2.1 release with template system refactoring (removal of legacy template redirects, introduction of new block template registration) and field improvements (CMB2 integration updates, metabox field changes).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e5d41e and 28acd9d.

📒 Files selected for processing (4)
  • classes/class-to-specials-templates.php (1 hunks)
  • includes/metaboxes/config-special.php (5 hunks)
  • templates/archive-special.html (1 hunks)
  • templates/single-special.html (1 hunks)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @krugazul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This release significantly refactors the plugin's template system to leverage modern WordPress block templates, enhancing compatibility and simplifying template management. Alongside this, custom field configurations have been refined for better user experience and integration with CMB2, and various post type labels and settings have been improved for clarity and consistency. The update also includes a substantial codebase cleanup, removing legacy components and updating plugin assets.

Highlights

  • Template System Overhaul: Introduced a new LSX_TO_Specials_Templates class for proper block template registration, including archive-special.html and single-special.html, and removed the legacy template system.
  • Field Improvements: Updated metabox configurations for better CMB2 integration, added post field support, fixed travel dates field naming, and improved field titles and descriptions.
  • Post Type Enhancements: Corrected post type labels for clarity and updated configurations for improved block editor support and registration consistency.
  • Codebase Cleanup: Removed unused files like class-template-redirects.php and gulpfile.js, resulting in a net reduction of 231 lines of code.
  • Asset Updates: Refreshed plugin assets, converting banner images to PNG and updating icons for WordPress.org branding.
  • Internationalization: Updated language files with new strings and improved translation consistency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 8

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2113a36 and 941e144.

⛔ Files ignored due to path filters (10)
  • .DS_Store is excluded by !**/.DS_Store
  • .wordpress-org/.DS_Store is excluded by !**/.DS_Store
  • .wordpress-org/banner-1544x500.jpg is excluded by !**/*.jpg
  • .wordpress-org/banner-1544x500.png is excluded by !**/*.png
  • .wordpress-org/banner-772x250.jpg is excluded by !**/*.jpg
  • .wordpress-org/banner-772x250.png is excluded by !**/*.png
  • .wordpress-org/icon-128x128.jpg is excluded by !**/*.jpg
  • .wordpress-org/icon-128x128.png is excluded by !**/*.png
  • .wordpress-org/icon-256x256.jpg is excluded by !**/*.jpg
  • .wordpress-org/icon-256x256.png is excluded by !**/*.png
📒 Files selected for processing (16)
  • README.md (1 hunks)
  • changelog.md (1 hunks)
  • classes/class-template-redirects.php (0 hunks)
  • classes/class-to-specials-admin.php (2 hunks)
  • classes/class-to-specials-templates.php (1 hunks)
  • classes/class-to-specials.php (1 hunks)
  • gulpfile.js (0 hunks)
  • includes/metaboxes/config-special.php (4 hunks)
  • includes/post-types/config-special.php (1 hunks)
  • languages/to-specials-en_EN.po (4 hunks)
  • languages/to-specials-en_US.po (4 hunks)
  • languages/to-specials.pot (4 hunks)
  • package.json (1 hunks)
  • templates/archive-special.html (1 hunks)
  • templates/single-special.html (1 hunks)
  • to-specials.php (2 hunks)
💤 Files with no reviewable changes (2)
  • gulpfile.js
  • classes/class-template-redirects.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/class-to-specials-templates.php (1)
classes/class-to-specials.php (1)
  • __construct (53-83)
🪛 PHPMD (2.15.0)
classes/class-to-specials-templates.php

9-79: The class LSX_TO_Specials_Templates is not named in CamelCase. (undefined)

(CamelCaseClassName)


34-66: The method register_post_type_templates is not named in camelCase. (undefined)

(CamelCaseMethodName)


39-39: The variable $post_types is not named in camelCase. (undefined)

(CamelCaseVariableName)


74-78: The method get_template_content is not named in camelCase. (undefined)

(CamelCaseMethodName)

🔇 Additional comments (22)
package.json (1)

3-3: Version bump looks correct, pending version consistency verification.

The version increment to 2.0.1 is appropriate for the scope of changes. However, ensure this aligns with the intended release version mentioned in the PR title (v2.1).

README.md (1)

1-1: LGTM!

Banner update is appropriate and aligns with the removal of gulp-based build workflow mentioned in the PR.

includes/post-types/config-special.php (2)

17-17: Excellent correction to singular_name label.

Changing from "Activity" to "Special" properly aligns the singular name with the post type's purpose. This improves UI consistency throughout the admin interface.


21-21: Correct grammar fix for new_item label.

Changing "New Specials" to "New Special" properly uses the singular form, consistent with WordPress admin UI conventions where new_item represents a single entity.

classes/class-to-specials-admin.php (2)

39-39: Good addition of post type support.

Adding the lsx_to_post_custom_fields filter extends the specials relationship field to generic posts, improving the plugin's flexibility.


101-101: Improved field label with proper translation.

Replacing the dynamic label with a translated "Related Specials" string ensures consistent UI text and proper internationalization support.

languages/to-specials-en_US.po (3)

5-5: Version and date headers updated correctly.

The version bump to 2.0.1 and POT-Creation-Date update are consistent with the release changes.

Also applies to: 12-12


71-85: New template strings added for block template support.

The addition of "Single Special Offer" and "Specials Offers Archive" translation entries properly supports the new block template system introduced in this release.


249-249: Translation string corrected to singular form.

The change from "New Specials" to "New Special" aligns with the post type label correction and maintains consistency across the UI.

classes/class-to-specials-templates.php (3)

62-64: Good defensive check for function existence.

The function_exists check before calling register_block_template properly guards against potential compatibility issues with older WordPress versions.


74-78: Template loading implementation is sound.

Using output buffering to capture template file content is the standard WordPress approach for template handling. The path construction using LSX_TO_SPECIALS_PATH ensures portability.


62-64: Verify register_block_template availability and minimum WordPress version.

The register_block_template function was introduced in WordPress 6.1. Ensure the plugin's minimum WordPress version requirement supports this function, or implement a graceful fallback for older versions.

What version of WordPress introduced the register_block_template function?
classes/class-to-specials.php (1)

76-76: LGTM!

The inclusion of the templates class is correctly positioned alongside other class requires and properly integrates the new block template registration system.

includes/metaboxes/config-special.php (4)

48-58: LGTM!

The migration from post_select to pw_multiselect with post_type_args is correct and follows CMB2 best practices for improved field handling.


110-113: LGTM!

The travel dates field name correction aligns with the PR objectives and maintains consistency between name and single_name properties.


171-196: LGTM!

The Envira Gallery field migrations to pw_multiselect with post_type_args are consistent with the broader refactoring and correctly implemented.


211-223: LGTM!

The related post type fields migration to pw_multiselect with post_type_args and non-repeatable configuration is correctly implemented and consistent with the refactoring pattern.

languages/to-specials.pot (2)

71-104: LGTM!

The new translation strings for the template system (Single Special Offer, Specials Offers Archive) and updated taxonomy labels (Special Type/Types) align with the PR objectives and are correctly formatted.


5-5: No action required. All version declarations are consistent at 2.0.1 across the POT file, package.json, main plugin file (to-specials.php), and changelog. The assumption in the original review that the PR summary stated "version 2.1" could not be verified and appears to be unfounded.

Likely an incorrect or invalid review comment.

languages/to-specials-en_EN.po (2)

71-104: LGTM!

The translation entries for the new template system and taxonomy labels are correctly structured and align with the POT file.


5-5: Geen weergaweversiebesprekings nodig.

Alle versieverklarings in die lêers is konsekwent by 2.0.1 – die plugin.php-lêer, package.json en alle PO-lêers (insluitend to-specials-en_EN.po by lyn 5) verklaar almal 2.0.1. Die changelog toon dat weergawe 2.0.1 tans WIP is. Daar is geen bewys van 'n weergawe 2.1 in die kodebase nie.

Likely an incorrect or invalid review comment.

to-specials.php (1)

6-6: Lines 6 and 23 are consistent – both declare version 2.0.1.

The plugin header (line 6) and version constant (line 23) use the same version number (2.0.1). However, there is a discrepancy between the code and the README.md file, which lists stable tag as 2.0.0. Ensure the README is updated to reflect the current version, or align the code to match the README if 2.0.0 is the intended release version.

Likely an incorrect or invalid review comment.

Comment thread changelog.md Outdated
Comment on lines +3 to +7
## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP

### Updated
- Fixing the post type labels.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Version mismatch between PR title and changelog.

The PR title indicates "Release v2.1", but the changelog and related files show version 2.0.1. Please verify which version is correct and ensure consistency across all version references (package.json, to-specials.php, changelog, translation files).

🤖 Prompt for AI Agents
In changelog.md around lines 3-7, the release header shows "2.0.1" while the PR
title says "Release v2.1"; determine the intended release version and make them
consistent by updating the changelog header and release link to the correct
version (e.g., change [[2.0.1]] and the GitHub tag URL to [[2.1]] and the
matching tag), then propagate that same version bump to package.json,
to-specials.php, and any translation/version files so all references match the
chosen version and update any release notes or labels accordingly.

Comment thread changelog.md Outdated
Comment thread classes/class-to-specials-templates.php
Comment thread includes/metaboxes/config-special.php
Comment thread includes/metaboxes/config-special.php
Comment thread includes/metaboxes/config-special.php
Comment on lines +1 to +2
<!-- wp:template-part {"slug":"header","area":"header"} /-->
<!-- wp:template-part {"slug":"footer","area":"footer"} /--> No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Archive template is missing content area.

This template only includes the header and footer template parts but completely lacks the main content area where special offers should be displayed. This will result in blank archive pages with no specials shown.

A typical archive template should include a query loop or post template block between the header and footer to display the special offers.

🔎 Proposed fix to add content area
 <!-- wp:template-part {"slug":"header","area":"header"} /-->
+<!-- wp:query {"query":{"postType":"special"},"layout":{"type":"default"}} -->
+<div class="wp-block-query">
+<!-- wp:post-template -->
+<!-- wp:post-title {"isLink":true} /-->
+<!-- wp:post-excerpt /-->
+<!-- /wp:post-template -->
+<!-- wp:query-pagination -->
+<!-- wp:query-pagination-previous /-->
+<!-- wp:query-pagination-numbers /-->
+<!-- wp:query-pagination-next /-->
+<!-- /wp:query-pagination -->
+</div>
+<!-- /wp:query -->
 <!-- wp:template-part {"slug":"footer","area":"footer"} /-->
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<!-- wp:template-part {"slug":"header","area":"header"} /-->
<!-- wp:template-part {"slug":"footer","area":"footer"} /-->
<!-- wp:template-part {"slug":"header","area":"header"} /-->
<!-- wp:query {"query":{"postType":"special"},"layout":{"type":"default"}} -->
<div class="wp-block-query">
<!-- wp:post-template -->
<!-- wp:post-title {"isLink":true} /-->
<!-- wp:post-excerpt /-->
<!-- /wp:post-template -->
<!-- wp:query-pagination -->
<!-- wp:query-pagination-previous /-->
<!-- wp:query-pagination-numbers /-->
<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->
</div>
<!-- /wp:query -->
<!-- wp:template-part {"slug":"footer","area":"footer"} /-->
🤖 Prompt for AI Agents
In templates/archive-special.html around lines 1 to 2, the template only
includes header and footer and is missing the main content area; add a proper
content region between the header and footer that renders the archive of special
offers (e.g., insert a main/container element with a Query Loop or Post Template
block to output the specials, include appropriate headings and fallback text for
no-results, and ensure classes/ARIA roles match theme structure so archive pages
display the list of specials).

Comment thread templates/single-special.html

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request is a great step forward in modernizing the plugin. The refactoring of the template system to use block templates is a significant improvement, and the cleanup of legacy files like class-template-redirects.php and gulpfile.js is excellent. The updates to the CMB2 metaboxes also improve the user experience and simplify the code. I've identified a few minor issues, including a potential typo in the template registration, some incorrect text domains, and opportunities to improve code documentation and robustness. Addressing these will help ensure the stability and maintainability of this release.

Comment thread classes/class-to-specials-templates.php
Comment thread changelog.md Outdated
Comment on lines +3 to +6
## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP

### Updated
- Fixing the post type labels.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The changelog entry for this version seems too brief given the scope of the changes. This PR includes a major template system overhaul, refactoring of custom fields, and removal of legacy code. Expanding the changelog to detail these significant improvements would be very helpful for users and developers tracking the project's progress.

Comment on lines +71 to +72
* @param [type] $template
* @return void

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The PHPDoc for the get_template_content method is incorrect. The @param should be string instead of [type], and the function returns a string, not void. Correcting the docblock will improve code clarity and help static analysis tools.

 * @param string $template
	 * @return string

*/
protected function get_template_content( $template ) {
ob_start();
include LSX_TO_SPECIALS_PATH . "/templates/{$template}";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The direct include could cause a fatal error if the template file is missing for any reason. It would be more robust to check if the file exists before including it. This prevents the site from breaking if a template file is accidentally deleted or renamed.

		$template_file = LSX_TO_SPECIALS_PATH . "/templates/{$template}";
		if ( file_exists( $template_file ) ) {
			include $template_file;
		}

Comment thread includes/metaboxes/config-special.php Outdated
$metabox['fields'][] = array(
'id' => 'gallery_title',
'name' => esc_html__( 'Gallery', 'to-specials' ),
'name' => esc_html__( 'Gallery', 'to-team' ),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The text domain for this string is to-team, which seems incorrect for this plugin. It should be to-specials to ensure proper translation.

	'name' => esc_html__( 'Gallery', 'to-specials' ),

Comment thread includes/metaboxes/config-special.php Outdated
);
$metabox['fields'][] = array(
'id' => 'related_title',
'name' => esc_html__( 'Related', 'to-team' ),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The text domain for this string is to-team. To ensure it can be translated correctly with the rest of the plugin, it should be updated to the to-specials text domain.

	'name' => esc_html__( 'Related', 'to-specials' ),

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (1)
includes/metaboxes/config-special.php (1)

160-169: Correct the field description text.

The gallery field description on line 161 incorrectly references "accommodation" when this metabox is for special offers. The description should reference the special's gallery instead.

🔎 Proposed fix
 $metabox['fields'][] = array(
     'name' => esc_html__( 'Gallery', 'to-specials' ),
-	'desc' => esc_html__( 'Add images related to the accommodation to be displayed in the Accommodation\'s gallery.', 'to-specials' ),
+	'desc' => esc_html__( 'Add images related to the special to be displayed in the Special\'s gallery.', 'to-specials' ),
     'id'   => 'gallery',
     'type' => 'file_list',
     'preview_size' => 'thumbnail',
     'query_args' => array( 'type' => 'image' ),
     'text' => array(
         'add_upload_files_text' => esc_html__( 'Add new image', 'to-specials' ),
     ),
 );
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 941e144 and 6e5d41e.

📒 Files selected for processing (7)
  • README.txt (1 hunks)
  • changelog.md (1 hunks)
  • classes/class-to-specials-schema.php (2 hunks)
  • classes/class-to-specials.php (2 hunks)
  • includes/metaboxes/config-special.php (5 hunks)
  • package.json (1 hunks)
  • to-specials.php (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
changelog.md

5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


8-8: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


13-13: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


21-21: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


26-26: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


31-31: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (11)
package.json (1)

3-3: LGTM!

The version bump to 2.1.0 is consistent with the release objectives and aligns with the version constant in to-specials.php.

README.txt (1)

6-8: LGTM!

The WordPress compatibility update to 6.9 and stable tag update to 2.1 are appropriate for this release. Note: WordPress plugin convention typically uses "2.1" format for stable tags whilst package.json uses semantic versioning "2.1.0" – this is acceptable and standard practice.

classes/class-to-specials-schema.php (1)

9-9: LGTM!

The documentation updates correctly reflect the Specials functionality, replacing the incorrect "Review" references with "Specials".

Also applies to: 26-28

changelog.md (1)

3-40: LGTM!

The 2.1 release section is comprehensive and well-structured, covering all key changes including the template system refactor, field improvements, and security updates.

to-specials.php (1)

6-6: LGTM!

The version updates (plugin header to 2.1 and constant to 2.1.0) are consistent with the release objectives and align with package.json versioning.

Also applies to: 23-23

classes/class-to-specials.php (2)

97-97: LGTM! Textdomain loading simplification is appropriate.

The simplified load_plugin_textdomain() call is correct, as WordPress will automatically search in the plugin's languages directory based on the Domain Path header (/languages) in the main plugin file. This aligns with WordPress best practices.


76-76: No action needed — class is properly instantiated.

The LSX_TO_Specials_Templates class is instantiated at line 81 of its own file (classes/class-to-specials-templates.php), immediately after the class definition. This instantiation activates automatically when the file is included via the require_once statement.

Likely an incorrect or invalid review comment.

includes/metaboxes/config-special.php (4)

11-11: LGTM!

The phpcs:disable directive appropriately suppresses the non-prefixed variable warning for the $metabox configuration variable, which is standard practice for return-based configuration files.


112-112: LGTM!

Adding a proper label for the Travel Dates field improves the admin UI clarity and correctly uses the to-specials text domain.


176-182: LGTM with verification pending.

The Envira Gallery fields have been consistently updated to use the pw_multiselect pattern. The configuration aligns with the Team field changes (lines 51-56), so the same verification applies.

Also applies to: 188-194


205-209: LGTM!

The Related section title has been added with the correct to-specials text domain. Previous text domain issues have been resolved.

Comment thread changelog.md
Comment on lines +5 to +36
### Description
This release introduces significant improvements to the template system, enhanced custom field configurations, and better Tour Operator 2.0 compatibility for the Special Offers plugin.

### Added
- New `LSX_TO_Specials_Templates` class for proper block template registration
- Block editor templates: `templates/archive-special.html` and `templates/single-special.html`
- Post field support for enhanced content management

### Updated
- Special metabox configurations for better CMB2 integration
- Field titles and descriptions for improved user guidance
- Post type labels for better clarity
- Plugin assets converted to PNG format (banners and icons)
- Language files (.po, .pot) with new strings and improved formatting
- Plugin version to 2.1 across all files

### Fixed
- Post type slug for single special offer template (changed from 'tour' to 'special')
- Travel dates field naming for consistency
- Template registration logic for block editor compatibility

### Removed
- Legacy `class-template-redirects.php` (189 lines removed)
- Unused `gulpfile.js` (51 lines removed)
- Obsolete template selection logic

### Changed
- Improved class structure and organization
- Simplified template loading system
- Enhanced field structure in metabox configurations

### Security

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider adding blank lines around section headings for better markdown formatting.

The markdown linter flags missing blank lines around headings (MD022). Whilst not critical, adding blank lines would improve readability and satisfy markdown best practices.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

5-5: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


8-8: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


13-13: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


21-21: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


26-26: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


31-31: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In changelog.md around lines 5 to 36, several section headings (e.g., "###
Description", "### Added", "### Updated", etc.) are missing surrounding blank
lines which triggers MD022; edit the file to insert a single blank line before
and after each heading so there is an empty line separating headings from
adjacent paragraphs and lists, ensure the file begins and ends with appropriate
spacing, and re-run your markdown linter to verify MD022 is resolved.

Comment thread changelog.md
- Tested with PHP 8.0+
- Code quality improvements for better security

## [[2.0.0]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.0) - 2025-05-09

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Correct repository URL in 2.0.0 release link.

The release link still references to-reviews but should reference to-specials to match this plugin's repository. This appears to be a copy-paste error that was fixed for the 2.1 release link but remains in the 2.0.0 section.

🔎 Proposed fix
-## [[2.0.0]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.0) - 2025-05-09
+## [[2.0.0]](https://github.com/lightspeeddevelopment/to-specials/releases/tag/2.0.0) - 2025-05-09
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## [[2.0.0]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.0) - 2025-05-09
## [[2.0.0]](https://github.com/lightspeeddevelopment/to-specials/releases/tag/2.0.0) - 2025-05-09
🤖 Prompt for AI Agents
In changelog.md around line 41, the 2.0.0 release link points to the wrong
repository (to-reviews) due to a copy-paste error; update the URL to reference
the correct repository (to-specials) so the markdown link for the 2.0.0 tag
matches this plugin's repo (mirror the pattern used for the 2.1.0 link),
ensuring the link target and tag path use to-specials instead of to-reviews.

Comment thread includes/metaboxes/config-special.php
Comment on lines +211 to 223
foreach ( $post_types as $slug => $label ) {
$metabox['fields'][] = array(
'id' => $slug . '_to_special',
'name' => $label . esc_html__( ' related with this special', 'to-specials' ),
'type' => 'post_select',
'type' => 'pw_multiselect',
'use_ajax' => false,
'repeatable' => true,
'repeatable' => false,
'allow_none' => true,
'query' => array(
'post_type' => $slug,
'nopagin' => true,
'posts_per_page' => '-1',
'orderby' => 'title',
'order' => 'ASC',
'options' => array(
'post_type_args' => $slug,
),
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider removing unnecessary 'repeatable' parameter.

Line 217 sets 'repeatable' => false for pw_multiselect fields. Since pw_multiselect is a multi-select field type (not a repeatable group), the repeatable parameter is unnecessary and could cause confusion. Consider removing it for cleaner configuration.

🔎 Proposed fix
 foreach ( $post_types as $slug => $label ) {
 	$metabox['fields'][] = array(
 		'id'         => $slug . '_to_special',
 		'name'       => $label . esc_html__( ' related with this special', 'to-specials' ),
 		'type'       => 'pw_multiselect',
 		'use_ajax'   => false,
-		'repeatable' => false,
 		'allow_none' => true,
 		'options'  => array(
 			'post_type_args' => $slug,
 		),
 	);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
foreach ( $post_types as $slug => $label ) {
$metabox['fields'][] = array(
'id' => $slug . '_to_special',
'name' => $label . esc_html__( ' related with this special', 'to-specials' ),
'type' => 'post_select',
'type' => 'pw_multiselect',
'use_ajax' => false,
'repeatable' => true,
'repeatable' => false,
'allow_none' => true,
'query' => array(
'post_type' => $slug,
'nopagin' => true,
'posts_per_page' => '-1',
'orderby' => 'title',
'order' => 'ASC',
'options' => array(
'post_type_args' => $slug,
),
);
}
foreach ( $post_types as $slug => $label ) {
$metabox['fields'][] = array(
'id' => $slug . '_to_special',
'name' => $label . esc_html__( ' related with this special', 'to-specials' ),
'type' => 'pw_multiselect',
'use_ajax' => false,
'allow_none' => true,
'options' => array(
'post_type_args' => $slug,
),
);
}
🤖 Prompt for AI Agents
In includes/metaboxes/config-special.php around lines 211 to 223, the
pw_multiselect field is configured with an unnecessary 'repeatable' => false
entry; remove the 'repeatable' line from the field array so the configuration
only includes relevant keys (id, name, type, use_ajax, allow_none, options) to
avoid confusion and keep the metabox definition clean.

@krugazul krugazul merged commit 9e11b8e into master Dec 20, 2025
3 of 7 checks passed
@mergify mergify Bot deleted the 2.0.1-trunk branch December 20, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Block-Based Templates for Specials (Promotional Tours)

1 participant