WordPress.org

Make WordPress Core

Ticket #35164: post-template.diff

File post-template.diff, 749 bytes (added by danielpataki, 4 years ago)

Adds the singular body class and the main-post post class

  • post-template.php

     
    473473                $classes[] = 'post-password-protected';
    474474        }
    475475
     476        // Main post
     477        if( is_main_query() ) {
     478                $classes[] = 'main-post';
     479        }
     480
    476481        // Post thumbnails.
    477482        if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
    478483                $classes[] = 'has-post-thumbnail';
     
    578583                $classes[] = 'attachment';
    579584        if ( is_404() )
    580585                $classes[] = 'error404';
     586        if( is_singular() ) {
     587                $classes[] = 'singular';
     588        }
    581589
    582590        if ( is_single() ) {
    583591                $post_id = $wp_query->get_queried_object_id();