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.


Built from https://develop.svn.wordpress.org/trunk@45256


git-svn-id: http://core.svn.wordpress.org/trunk@45065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2019-04-23 13:04:56 +00:00
parent 0feb55f633
commit 18ccaf962e
10 changed files with 162 additions and 3 deletions

View File

@ -883,3 +883,21 @@ function twentyeleven_widget_tag_cloud_args( $args ) {
return $args;
}
add_filter( 'widget_tag_cloud_args', 'twentyeleven_widget_tag_cloud_args' );
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Eleven 3.3
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Eleven 3.3
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -267,3 +267,21 @@ if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) :
}
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Fifteen 2.5
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Fifteen 2.5
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -232,3 +232,21 @@ if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) :
}
add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Fourteen 2.7
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Fourteen 2.7
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -238,3 +238,21 @@ if ( ! function_exists( 'twentynineteen_the_posts_navigation' ) ) :
);
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Nineteen 1.4
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Nineteen 1.4
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -198,3 +198,21 @@ function twentyseventeen_category_transient_flusher() {
}
add_action( 'edit_category', 'twentyseventeen_category_transient_flusher' );
add_action( 'save_post', 'twentyseventeen_category_transient_flusher' );
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Seventeen 2.2
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Seventeen 2.2
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -264,3 +264,21 @@ if ( ! function_exists( 'twentysixteen_the_custom_logo' ) ) :
}
}
endif;
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Sixteen 2.0
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Sixteen 2.0
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -718,4 +718,20 @@ function twentyten_block_editor_styles() {
}
add_action( 'enqueue_block_editor_assets', 'twentyten_block_editor_styles' );
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Ten 2.9
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Ten 2.9
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -778,3 +778,21 @@ function twentythirteen_widget_tag_cloud_args( $args ) {
return $args;
}
add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Thirteen 2.8
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Thirteen 2.8
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -667,7 +667,6 @@ function twentytwelve_customize_preview_js() {
}
add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
/**
* Modifies tag cloud widget arguments to display all tags in the same font size
* and use list format for better accessibility.
@ -686,3 +685,21 @@ function twentytwelve_widget_tag_cloud_args( $args ) {
return $args;
}
add_filter( 'widget_tag_cloud_args', 'twentytwelve_widget_tag_cloud_args' );
if ( ! function_exists( 'wp_body_open' ) ) :
/**
* Fire the wp_body_open action.
*
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
*
* @since Twenty Twelve 3.0
*/
function wp_body_open() {
/**
* Triggered after the opening <body> tag.
*
* @since Twenty Twelve 3.0
*/
do_action( 'wp_body_open' );
}
endif;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta3-45255';
$wp_version = '5.2-beta3-45256';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.