wp_theme_auto_update_setting_template

函式
wp_theme_auto_update_setting_template ( No parameters )
返回值
  • (string) The template for displaying the auto-update setting link.
定義位置
相關方法
core_auto_updates_settingswp_print_update_row_templateswp_is_auto_update_enabled_for_typewp_nav_menu_update_menu_itemswp_get_auto_update_message
引入
5.5.0
棄用
-

wp_theme_auto_update_setting_template 是一個函式,用於輸出WordPress主題編輯器中”自動更新”設定的HTML模板。這個設定允許使用者指定是否應該自動安裝主題的更新。

返回用於顯示一個主題的自動更新設定的JavaScript模板。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_theme_auto_update_setting_template() {
$template = '
<div class="theme-autoupdate">
<# if ( data.autoupdate.supported ) { #>
<# if ( data.autoupdate.forced === false ) { #>
' . __( 'Auto-updates disabled' ) . '
<# } else if ( data.autoupdate.forced ) { #>
' . __( 'Auto-updates enabled' ) . '
<# } else if ( data.autoupdate.enabled ) { #>
<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
</button>
<# } else { #>
<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
</button>
<# } #>
<# } #>
<# if ( data.hasUpdate ) { #>
<# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
<span class="auto-update-time">
<# } else { #>
<span class="auto-update-time hidden">
<# } #>
<br />' . wp_get_auto_update_message() . '</span>
<# } #>
<div class="notice notice-error notice-alt inline hidden"><p></p></div>
</div>
';
/**
* Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
*
* See {@see wp_prepare_themes_for_js()} for the properties of the `data` object.
*
* @since 5.5.0
*
* @param string $template The template for displaying the auto-update setting link.
*/
return apply_filters( 'theme_auto_update_setting_template', $template );
}
function wp_theme_auto_update_setting_template() { $template = ' <div class="theme-autoupdate"> <# if ( data.autoupdate.supported ) { #> <# if ( data.autoupdate.forced === false ) { #> ' . __( 'Auto-updates disabled' ) . ' <# } else if ( data.autoupdate.forced ) { #> ' . __( 'Auto-updates enabled' ) . ' <# } else if ( data.autoupdate.enabled ) { #> <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable"> <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span> </button> <# } else { #> <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable"> <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span> </button> <# } #> <# } #> <# if ( data.hasUpdate ) { #> <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #> <span class="auto-update-time"> <# } else { #> <span class="auto-update-time hidden"> <# } #> <br />' . wp_get_auto_update_message() . '</span> <# } #> <div class="notice notice-error notice-alt inline hidden"><p></p></div> </div> '; /** * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay). * * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object. * * @since 5.5.0 * * @param string $template The template for displaying the auto-update setting link. */ return apply_filters( 'theme_auto_update_setting_template', $template ); }
function wp_theme_auto_update_setting_template() {
	$template = '
		<div class="theme-autoupdate">
			<# if ( data.autoupdate.supported ) { #>
				<# if ( data.autoupdate.forced === false ) { #>
					' . __( 'Auto-updates disabled' ) . '
				<# } else if ( data.autoupdate.forced ) { #>
					' . __( 'Auto-updates enabled' ) . '
				<# } else if ( data.autoupdate.enabled ) { #>
					<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
						<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
					</button>
				<# } else { #>
					<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
						<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
					</button>
				<# } #>
			<# } #>
			<# if ( data.hasUpdate ) { #>
				<# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
					<span class="auto-update-time">
				<# } else { #>
					<span class="auto-update-time hidden">
				<# } #>
				<br />' . wp_get_auto_update_message() . '</span>
			<# } #>
			<div class="notice notice-error notice-alt inline hidden"><p></p></div>
		</div>
	';

	/**
	 * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
	 *
	 * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object.
	 *
	 * @since 5.5.0
	 *
	 * @param string $template The template for displaying the auto-update setting link.
	 */
	return apply_filters( 'theme_auto_update_setting_template', $template );
}

常見問題

FAQs
檢視更多 >