Make WordPress Core

Changeset 59689


Ignore:
Timestamp:
01/22/2025 09:16:19 PM (21 months ago)
Author:
audrasjb
Message:

Themes: Add wp-singular to the list of body classes when viewing a single post object.

The wp-singular class includes a wp prefix to avoid conflicts with existing classes. This changeset also updates the Tests_Post_GetBodyClass PHPUnit test to include the new CSS class.

Props danielpataki, peterwilsoncc, swissspidy, johnbillion, eceleste, poena, audrasjb, raj198, shailu25.
Fixes #35164.

Location:
trunk
Files:
2 edited

Legend:

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

    r58846 r59689  
    676676                $post_id   = $post->ID;
    677677                $post_type = $post->post_type;
     678
     679                $classes[] = 'wp-singular';
    678680
    679681                if ( is_page_template() ) {
  • trunk/tests/phpunit/tests/post/getBodyClass.php

    r56547 r59689  
    106106                $this->assertContains( "postid-{$post_id}", $class );
    107107                $this->assertContains( 'single-format-standard', $class );
     108                $this->assertContains( 'wp-singular', $class );
    108109        }
    109110
Note: See TracChangeset for help on using the changeset viewer.