WP_Scripts::print_extra_script
Prints extra scripts of a registered script.
Метод класса: WP_Scripts{}
Хуков нет.
Возвращает
true|false|Строку|null. Void if no data exists, extra scripts if $display is true, true otherwise.
Использование
global $wp_scripts; $wp_scripts->print_extra_script( $handle, $display );
- $handle(строка) (обязательный)
- The script's registered handle.
- $display(true|false)
- Whether to print the extra script instead of just returning it.
По умолчанию: true
Список изменений
| С версии 3.3.0 | Введена. |
Код WP_Scripts::print_extra_script() WP Scripts::print extra script WP 6.8.3
public function print_extra_script( $handle, $display = true ) {
$output = $this->get_data( $handle, 'data' );
if ( ! $output ) {
return;
}
if ( ! $display ) {
return $output;
}
wp_print_inline_script_tag( $output, array( 'id' => "{$handle}-js-extra" ) );
return true;
}