Skip to content

Commit 5cc7acd

Browse files
Bundled Theme: add a wp_body_open shim for older WordPress versions.
WordPress 5.2 adds the `wp_body_open()` function, and the default themes make use of it. This patch adds a shim for `wp_body_open` to bundled themes so this function will also work in older versions of WordPress. Props lgedeon, johnbillion, timph, ramiy, pento. Fixes #46679. git-svn-id: https://develop.svn.wordpress.org/trunk@45256 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7bdef3d commit 5cc7acd

9 files changed

Lines changed: 161 additions & 2 deletions

File tree

src/wp-content/themes/twentyeleven/functions.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,3 +883,21 @@ function twentyeleven_widget_tag_cloud_args( $args ) {
883883
return $args;
884884
}
885885
add_filter( 'widget_tag_cloud_args', 'twentyeleven_widget_tag_cloud_args' );
886+
887+
if ( ! function_exists( 'wp_body_open' ) ) :
888+
/**
889+
* Fire the wp_body_open action.
890+
*
891+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
892+
*
893+
* @since Twenty Eleven 3.3
894+
*/
895+
function wp_body_open() {
896+
/**
897+
* Triggered after the opening <body> tag.
898+
*
899+
* @since Twenty Eleven 3.3
900+
*/
901+
do_action( 'wp_body_open' );
902+
}
903+
endif;

src/wp-content/themes/twentyfifteen/inc/template-tags.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,21 @@ function twentyfifteen_the_custom_logo() {
267267
}
268268
}
269269
endif;
270+
271+
if ( ! function_exists( 'wp_body_open' ) ) :
272+
/**
273+
* Fire the wp_body_open action.
274+
*
275+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
276+
*
277+
* @since Twenty Fifteen 2.5
278+
*/
279+
function wp_body_open() {
280+
/**
281+
* Triggered after the opening <body> tag.
282+
*
283+
* @since Twenty Fifteen 2.5
284+
*/
285+
do_action( 'wp_body_open' );
286+
}
287+
endif;

src/wp-content/themes/twentyfourteen/inc/template-tags.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,21 @@ function twentyfourteen_excerpt_more( $more ) {
232232
}
233233
add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
234234
endif;
235+
236+
if ( ! function_exists( 'wp_body_open' ) ) :
237+
/**
238+
* Fire the wp_body_open action.
239+
*
240+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
241+
*
242+
* @since Twenty Fourteen 2.7
243+
*/
244+
function wp_body_open() {
245+
/**
246+
* Triggered after the opening <body> tag.
247+
*
248+
* @since Twenty Fourteen 2.7
249+
*/
250+
do_action( 'wp_body_open' );
251+
}
252+
endif;

src/wp-content/themes/twentynineteen/inc/template-tags.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,21 @@ function twentynineteen_the_posts_navigation() {
238238
);
239239
}
240240
endif;
241+
242+
if ( ! function_exists( 'wp_body_open' ) ) :
243+
/**
244+
* Fire the wp_body_open action.
245+
*
246+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
247+
*
248+
* @since Twenty Nineteen 1.4
249+
*/
250+
function wp_body_open() {
251+
/**
252+
* Triggered after the opening <body> tag.
253+
*
254+
* @since Twenty Nineteen 1.4
255+
*/
256+
do_action( 'wp_body_open' );
257+
}
258+
endif;

src/wp-content/themes/twentyseventeen/inc/template-tags.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,21 @@ function twentyseventeen_category_transient_flusher() {
198198
}
199199
add_action( 'edit_category', 'twentyseventeen_category_transient_flusher' );
200200
add_action( 'save_post', 'twentyseventeen_category_transient_flusher' );
201+
202+
if ( ! function_exists( 'wp_body_open' ) ) :
203+
/**
204+
* Fire the wp_body_open action.
205+
*
206+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
207+
*
208+
* @since Twenty Seventeen 2.2
209+
*/
210+
function wp_body_open() {
211+
/**
212+
* Triggered after the opening <body> tag.
213+
*
214+
* @since Twenty Seventeen 2.2
215+
*/
216+
do_action( 'wp_body_open' );
217+
}
218+
endif;

src/wp-content/themes/twentysixteen/inc/template-tags.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,21 @@ function twentysixteen_the_custom_logo() {
264264
}
265265
}
266266
endif;
267+
268+
if ( ! function_exists( 'wp_body_open' ) ) :
269+
/**
270+
* Fire the wp_body_open action.
271+
*
272+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
273+
*
274+
* @since Twenty Sixteen 2.0
275+
*/
276+
function wp_body_open() {
277+
/**
278+
* Triggered after the opening <body> tag.
279+
*
280+
* @since Twenty Sixteen 2.0
281+
*/
282+
do_action( 'wp_body_open' );
283+
}
284+
endif;

src/wp-content/themes/twentyten/functions.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,4 +718,20 @@ function twentyten_block_editor_styles() {
718718
}
719719
add_action( 'enqueue_block_editor_assets', 'twentyten_block_editor_styles' );
720720

721-
721+
if ( ! function_exists( 'wp_body_open' ) ) :
722+
/**
723+
* Fire the wp_body_open action.
724+
*
725+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
726+
*
727+
* @since Twenty Ten 2.9
728+
*/
729+
function wp_body_open() {
730+
/**
731+
* Triggered after the opening <body> tag.
732+
*
733+
* @since Twenty Ten 2.9
734+
*/
735+
do_action( 'wp_body_open' );
736+
}
737+
endif;

src/wp-content/themes/twentythirteen/functions.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,3 +778,21 @@ function twentythirteen_widget_tag_cloud_args( $args ) {
778778
return $args;
779779
}
780780
add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
781+
782+
if ( ! function_exists( 'wp_body_open' ) ) :
783+
/**
784+
* Fire the wp_body_open action.
785+
*
786+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
787+
*
788+
* @since Twenty Thirteen 2.8
789+
*/
790+
function wp_body_open() {
791+
/**
792+
* Triggered after the opening <body> tag.
793+
*
794+
* @since Twenty Thirteen 2.8
795+
*/
796+
do_action( 'wp_body_open' );
797+
}
798+
endif;

src/wp-content/themes/twentytwelve/functions.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@ function twentytwelve_customize_preview_js() {
667667
}
668668
add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
669669

670-
671670
/**
672671
* Modifies tag cloud widget arguments to display all tags in the same font size
673672
* and use list format for better accessibility.
@@ -686,3 +685,21 @@ function twentytwelve_widget_tag_cloud_args( $args ) {
686685
return $args;
687686
}
688687
add_filter( 'widget_tag_cloud_args', 'twentytwelve_widget_tag_cloud_args' );
688+
689+
if ( ! function_exists( 'wp_body_open' ) ) :
690+
/**
691+
* Fire the wp_body_open action.
692+
*
693+
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
694+
*
695+
* @since Twenty Twelve 3.0
696+
*/
697+
function wp_body_open() {
698+
/**
699+
* Triggered after the opening <body> tag.
700+
*
701+
* @since Twenty Twelve 3.0
702+
*/
703+
do_action( 'wp_body_open' );
704+
}
705+
endif;

0 commit comments

Comments
 (0)