mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
Add the ability to print data *after* a script, whether it is concatenated or not:
* Add a third argument to `WP_Scripts->print_extra_script()`, `$key`, which will be passed to `->get_data()` (no longer passes hardcoded `'data'`) * When `$key` is set to `'data-after'`, the inline script will be printed after the `<script>` tag. If the scripts are being concatenated, all scripts' `'data-after'` data will be printed after the concatenated `<script>` has been rendered. Props hakre, wonderboymusic. Fixes #25277. git-svn-id: https://develop.svn.wordpress.org/trunk@31032 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -857,8 +857,21 @@ function _print_scripts() {
|
||||
echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
|
||||
}
|
||||
|
||||
if ( !empty($wp_scripts->print_html) )
|
||||
if ( ! empty( $wp_scripts->print_html ) ) {
|
||||
echo $wp_scripts->print_html;
|
||||
}
|
||||
|
||||
if ( ! empty( $wp_scripts->print_after_html ) ) {
|
||||
if ( $wp_scripts->do_concat ) {
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "/* <![CDATA[ */\n"; // not needed in HTML 5
|
||||
echo trim( $wp_scripts->print_after_html ) . "\n";
|
||||
echo "/* ]]> */\n";
|
||||
echo "</script>\n";
|
||||
} else {
|
||||
echo $wp_scripts->print_after_html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user