WordPress.org

Make WordPress Core

Ticket #18698: 18698.diff

File 18698.diff, 1.1 KB (added by GaryJ, 7 years ago)

Add 'custom-background' body class, and reference it in default custom background callback.

  • wp-includes/post-template.php

     
    434434                // Post Format
    435435                if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
    436436                        $post_format = get_post_format( $post->ID );
    437        
     437
    438438                        if ( $post_format && !is_wp_error($post_format) )
    439439                                $classes[] = 'single-format-' . sanitize_html_class( $post_format );
    440440                        else
     
    507507        if ( is_admin_bar_showing() )
    508508                $classes[] = 'admin-bar';
    509509
     510        if ( get_background_image() || get_background_color() )
     511                $classes[] = 'custom-background';
     512
    510513        $page = $wp_query->get( 'page' );
    511514
    512515        if ( !$page || $page < 2)
  • wp-includes/theme.php

     
    17941794        }
    17951795?>
    17961796<style type="text/css">
    1797 body { <?php echo trim( $style ); ?> }
     1797body.custom-background { <?php echo trim( $style ); ?> }
    17981798</style>
    17991799<?php
    18001800}