From 18ccaf962eac99ad75709853223ce150301ae544 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Tue, 23 Apr 2019 13:04:56 +0000 Subject: [PATCH] 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 --- wp-content/themes/twentyeleven/functions.php | 18 ++++++++++++++++++ .../twentyfifteen/inc/template-tags.php | 18 ++++++++++++++++++ .../twentyfourteen/inc/template-tags.php | 18 ++++++++++++++++++ .../twentynineteen/inc/template-tags.php | 18 ++++++++++++++++++ .../twentyseventeen/inc/template-tags.php | 18 ++++++++++++++++++ .../twentysixteen/inc/template-tags.php | 18 ++++++++++++++++++ wp-content/themes/twentyten/functions.php | 18 +++++++++++++++++- .../themes/twentythirteen/functions.php | 18 ++++++++++++++++++ wp-content/themes/twentytwelve/functions.php | 19 ++++++++++++++++++- wp-includes/version.php | 2 +- 10 files changed, 162 insertions(+), 3 deletions(-) diff --git a/wp-content/themes/twentyeleven/functions.php b/wp-content/themes/twentyeleven/functions.php index b3b1466ef4..52b53ba90b 100644 --- a/wp-content/themes/twentyeleven/functions.php +++ b/wp-content/themes/twentyeleven/functions.php @@ -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 tag. + * + * @since Twenty Eleven 3.3 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentyfifteen/inc/template-tags.php b/wp-content/themes/twentyfifteen/inc/template-tags.php index 056d19413c..6af6e750fd 100644 --- a/wp-content/themes/twentyfifteen/inc/template-tags.php +++ b/wp-content/themes/twentyfifteen/inc/template-tags.php @@ -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 tag. + * + * @since Twenty Fifteen 2.5 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentyfourteen/inc/template-tags.php b/wp-content/themes/twentyfourteen/inc/template-tags.php index 1500386440..f1e952943b 100644 --- a/wp-content/themes/twentyfourteen/inc/template-tags.php +++ b/wp-content/themes/twentyfourteen/inc/template-tags.php @@ -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 tag. + * + * @since Twenty Fourteen 2.7 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentynineteen/inc/template-tags.php b/wp-content/themes/twentynineteen/inc/template-tags.php index e99ef86962..6b210bcaaf 100644 --- a/wp-content/themes/twentynineteen/inc/template-tags.php +++ b/wp-content/themes/twentynineteen/inc/template-tags.php @@ -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 tag. + * + * @since Twenty Nineteen 1.4 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentyseventeen/inc/template-tags.php b/wp-content/themes/twentyseventeen/inc/template-tags.php index 8fec665a28..2c24e4ec25 100644 --- a/wp-content/themes/twentyseventeen/inc/template-tags.php +++ b/wp-content/themes/twentyseventeen/inc/template-tags.php @@ -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 tag. + * + * @since Twenty Seventeen 2.2 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentysixteen/inc/template-tags.php b/wp-content/themes/twentysixteen/inc/template-tags.php index caeed1c5ac..55578bead0 100644 --- a/wp-content/themes/twentysixteen/inc/template-tags.php +++ b/wp-content/themes/twentysixteen/inc/template-tags.php @@ -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 tag. + * + * @since Twenty Sixteen 2.0 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index a3617c6a1a..2de25d382e 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -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 tag. + * + * @since Twenty Ten 2.9 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index d767bfe588..5c021fbe3c 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -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 tag. + * + * @since Twenty Thirteen 2.8 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-content/themes/twentytwelve/functions.php b/wp-content/themes/twentytwelve/functions.php index 22c212edbe..ad89b2ac72 100644 --- a/wp-content/themes/twentytwelve/functions.php +++ b/wp-content/themes/twentytwelve/functions.php @@ -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 tag. + * + * @since Twenty Twelve 3.0 + */ + do_action( 'wp_body_open' ); + } +endif; diff --git a/wp-includes/version.php b/wp-includes/version.php index cdc828cb26..c525639a1b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.