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/nav-menu-template.php

    r43571 r44966  
    362362    $possible_object_parents = array_filter( $possible_object_parents );
    363363
    364     $front_page_url = home_url();
    365     $front_page_id  = (int) get_option( 'page_on_front' );
     364    $front_page_url         = home_url();
     365    $front_page_id          = (int) get_option( 'page_on_front' );
     366    $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
    366367
    367368    foreach ( (array) $menu_items as $key => $menu_item ) {
     
    377378        if ( 'post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id ) {
    378379            $classes[] = 'menu-item-home';
     380        }
     381
     382        // This menu item is set as the 'Privacy Policy Page'.
     383        if ( 'post_type' === $menu_item->type && $privacy_policy_page_id === (int) $menu_item->object_id ) {
     384            $classes[] = 'menu-item-privacy-policy';
    379385        }
    380386
Note: See TracChangeset for help on using the changeset viewer.