Make WordPress Core


Ignore:
Timestamp:
03/21/2019 07:47:29 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Privacy: Introduce Privacy Policy page helpers:

  • is_privacy_policy() template tag
  • privacy-policy.php template
  • .privacy-policy body class
  • .menu-item-privacy-policy menu item class

Props garrett-eclipse, birgire, xkon, Clorith.
Fixes #44005.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/template.php

    r44569 r44966  
    3434     *
    3535     * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
    36      * 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
     36     * 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
    3737     *
    3838     * @since 4.7.0
     
    5252     *
    5353     * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
    54      * 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
     54     * 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
    5555     *
    5656     * @since 1.5.0
     
    375375
    376376    return get_query_template( 'front_page', $templates );
     377}
     378
     379/**
     380 * Retrieve path of Privacy Policy page template in current or parent template.
     381 *
     382 * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
     383 * and {@see '$type_template'} dynamic hooks, where `$type` is 'privacypolicy'.
     384 *
     385 * @since 5.2.0
     386 *
     387 * @see get_query_template()
     388 *
     389 * @return string Full path to front page template file.
     390 */
     391function get_privacy_policy_template() {
     392    $templates = array( 'privacy-policy.php' );
     393
     394    return get_query_template( 'privacy_policy', $templates );
    377395}
    378396
Note: See TracChangeset for help on using the changeset viewer.