[wp-trac] [WordPress Trac] #30299: Inconsistent custom-background Body Class Behavior

WordPress Trac noreply at wordpress.org
Sun Nov 16 22:06:32 UTC 2014


#30299: Inconsistent custom-background Body Class Behavior
-------------------------------+------------------------------
 Reporter:  philiparthurmoore  |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Customize          |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by philiparthurmoore):

 Regarding the custom function that I wrote above, this is actually a more
 reliable function that I'm using, which takes into account `false` for
 `get_theme_mod( 'background_color' )` for new blogs with no theme mods:

 {{{
 <?php
 /**
  * Ensure that the background is truly customized.
  *
  * @link https://core.trac.wordpress.org/ticket/30299
  */
 function truly_customized_background( $classes ) {
         $background_color = get_theme_mod( 'background_color' );

         if ( get_background_image() || ( ! empty( $background_color ) &&
 'fafafa' !== $background_color ) ) {
                 $classes[] = 'customized-background';
         }

         return $classes;
 } // end function truly_customized_background
 add_filter( 'body_class', 'truly_customized_background' );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30299#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list