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/tests/phpunit/tests/post/getBodyClass.php

    r43571 r44966  
    203203        $this->assertContains( 'attachment-jpeg', $class );
    204204    }
     205
     206    /**
     207     * @ticket 44005
     208     * @group privacy
     209     */
     210    public function test_privacy_policy_body_class() {
     211        $page_id = self::factory()->post->create(
     212            array(
     213                'post_type'  => 'page',
     214                'post_title' => 'Privacy Policy',
     215            )
     216        );
     217        update_option( 'wp_page_for_privacy_policy', $page_id );
     218
     219        $this->go_to( get_permalink( $page_id ) );
     220
     221        $class = get_body_class();
     222
     223        $this->assertContains( 'privacy-policy', $class );
     224        $this->assertContains( 'page-template-default', $class );
     225        $this->assertContains( 'page', $class );
     226        $this->assertContains( "page-id-{$page_id}", $class );
     227    }
     228
    205229}
Note: See TracChangeset for help on using the changeset viewer.