Release v2.1 - Template System Refactoring and Field Improvements#101
Conversation
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughRemoved 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (4)
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 |
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Actionable comments posted: 8
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (10)
.DS_Storeis excluded by!**/.DS_Store.wordpress-org/.DS_Storeis excluded by!**/.DS_Store.wordpress-org/banner-1544x500.jpgis excluded by!**/*.jpg.wordpress-org/banner-1544x500.pngis excluded by!**/*.png.wordpress-org/banner-772x250.jpgis excluded by!**/*.jpg.wordpress-org/banner-772x250.pngis excluded by!**/*.png.wordpress-org/icon-128x128.jpgis excluded by!**/*.jpg.wordpress-org/icon-128x128.pngis excluded by!**/*.png.wordpress-org/icon-256x256.jpgis excluded by!**/*.jpg.wordpress-org/icon-256x256.pngis 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_fieldsfilter 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_existscheck before callingregister_block_templateproperly 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_PATHensures portability.
62-64: Verify register_block_template availability and minimum WordPress version.The
register_block_templatefunction 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_selecttopw_multiselectwithpost_type_argsis 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
nameandsingle_nameproperties.
171-196: LGTM!The Envira Gallery field migrations to
pw_multiselectwithpost_type_argsare consistent with the broader refactoring and correctly implemented.
211-223: LGTM!The related post type fields migration to
pw_multiselectwithpost_type_argsand 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.
| ## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP | ||
|
|
||
| ### Updated | ||
| - Fixing the post type labels. | ||
|
|
There was a problem hiding this comment.
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.
| <!-- wp:template-part {"slug":"header","area":"header"} /--> | ||
| <!-- wp:template-part {"slug":"footer","area":"footer"} /--> No newline at end of file |
There was a problem hiding this comment.
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.
| <!-- 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).
There was a problem hiding this comment.
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.
| ## [[2.0.1]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.1) - WIP | ||
|
|
||
| ### Updated | ||
| - Fixing the post type labels. |
There was a problem hiding this comment.
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.
| * @param [type] $template | ||
| * @return void |
There was a problem hiding this comment.
| */ | ||
| protected function get_template_content( $template ) { | ||
| ob_start(); | ||
| include LSX_TO_SPECIALS_PATH . "/templates/{$template}"; |
There was a problem hiding this comment.
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;
}| $metabox['fields'][] = array( | ||
| 'id' => 'gallery_title', | ||
| 'name' => esc_html__( 'Gallery', 'to-specials' ), | ||
| 'name' => esc_html__( 'Gallery', 'to-team' ), |
| ); | ||
| $metabox['fields'][] = array( | ||
| 'id' => 'related_title', | ||
| 'name' => esc_html__( 'Related', 'to-team' ), |
There was a problem hiding this comment.
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
📒 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_Templatesclass 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 therequire_oncestatement.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
$metaboxconfiguration 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-specialstext domain.
176-182: LGTM with verification pending.The Envira Gallery fields have been consistently updated to use the
pw_multiselectpattern. 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-specialstext domain. Previous text domain issues have been resolved.
| ### 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 |
There was a problem hiding this comment.
🧹 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.
| - 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 |
There was a problem hiding this comment.
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.
| ## [[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.
| 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, | ||
| ), | ||
| ); | ||
| } |
There was a problem hiding this comment.
🧹 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.
| 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.
…block to templates
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_Templatesclass for proper block template registrationarchive-special.htmlandsingle-special.htmlblock templatesTemplate Cleanup: Removed legacy template system
class-template-redirects.php(189 lines removed)gulpfile.js(51 lines removed)🔧 Field Improvements
🎯 Post Type Enhancements
🎨 Assets & Branding
🌐 Internationalization
Technical Details
Commit History
941e144- Fix post type slug for single special offer template6ebc801- Updating field titlee38a890- Adding post field support0feab12- Fixing travel dates field nameb44b73f- Updating metaboxesd8e9fc3- Fixing post type labels3893539- Adding template selectionc6b366d- Deleting unused template file3ab2012- Updating plugin assetsKey Improvements
Testing Recommendations
Breaking Changes
None - This is a backward-compatible release
Contributors
Related Links
Merge Checklist:
Summary by CodeRabbit
New Features
Improvements
Removed
Chores
✏️ Tip: You can customize this high-level summary in your review settings.