WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#25379 closed enhancement (duplicate)

Add filter hook to modify css selector for _custom_background_cb()

Reported by: miyauchi Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Themes Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Currently theme's custom background can only be applied to body.custom-background CSS class. This patch adds a filter hook to _custom_background_cb() so theme author can change the CSS selector to apply the custom background to.

Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 25477)
+++ wp-includes/theme.php	(working copy)
@@ -1188,9 +1188,12 @@
 
 		$style .= $image . $repeat . $position . $attachment;
 	}
+
+    $css_selector = apply_filters( 'custom_background_css_selector', 'body.custom-background' );
+
 ?>
 <style type="text/css" id="custom-background-css">
-body.custom-background { <?php echo trim( $style ); ?> }
+<?php echo trim( $css_selector ); ?> { <?php echo trim( $style ); ?> }
 </style>
 <?php
 }
@@ -1750,4 +1753,4 @@
 		}());
 	</script>
 	<?php
-}
\ No newline at end of file
+}

Attachments (1)

theme.diff (660 bytes) - added by miyauchi 6 years ago.
patch for wp-include/theme.php

Download all attachments as: .zip

Change History (3)

@miyauchi
6 years ago

patch for wp-include/theme.php

#1 @ocean90
6 years ago

  • Component changed from General to Themes
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Type changed from feature request to enhancement

Duplicate of #21627.

#2 @SergeyBiryukov
6 years ago

  • Version changed from trunk to 3.6
Note: See TracTickets for help on using tickets.