[wp-trac] [WordPress Trac] #44005: Privacy template file
WordPress Trac
noreply at wordpress.org
Sun Mar 3 09:18:19 UTC 2019
#44005: Privacy template file
-------------------------------------------------+-------------------------
Reporter: Clorith | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future
| Release
Component: Privacy | Version: 4.9.6
Severity: normal | Resolution:
Keywords: needs-patch 2nd-opinion needs- | Focuses: template,
testing needs-unit-tests dev-feedback | privacy
-------------------------------------------------+-------------------------
Changes (by garrett-eclipse):
* keywords: needs-patch 2nd-opinion needs-testing => needs-patch 2nd-
opinion needs-testing needs-unit-tests dev-feedback
Comment:
Thanks @xkon for getting this started.
I've expanded on your patch mainly to introduce the `privacy-policy.php`
to the template hierarchy but also to cover the `pagename`/`page_id`
queries.
Full list of changes;
- Updating comment verbiage to 'Privacy Policy page' to match convention
in core.
- Updated @since to semantic versioning `5.2.0`
- Expanded on docblocks to match level of verbosity as the front_page and
home related functions.
- Moved functions to below is_home/front_page methods to keep all that
relate to option settings grouped.
- Updated `is_privacy_policy` logic to drop `get_queried_object` in favour
of using `is_page` with the option value to match `is_front_page` logic.
- Added `is_privacy_policy` declaration to the `init_query_flags` funciton
in `class-wp-query.php`
- Added check when queryvar is `pagename` to set `is_privacy_policy` to
true if matching current option for `wp_page_for_privacy_policy`.
- Added check when queryvar is `page_id` to set `is_privacy_policy` to
true if matching current option for `wp_page_for_privacy_policy`.
- Created `get_privacy_policy_template` to map the `privacy-policy.php`
template.
- Added `privacypolicy` to the list of possible values for the `$type` on
the `{$type}_template_hierarchy` and `{$type}_template` filters
I've tested this successfully confirming that the` privacy-policy` body
class is applied, the `is_privacy_policy()` function and the `privacy-
policy.php` template all function properly only on the page set as the
Privacy Policy page and no others. Works when in both draft and public
states.
Applying `needs-unit-tests` as next steps and would love additional
testing and review.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44005#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list