switch_theme()将当前主题转换为新模板和新的样式表单名称

目录

描述

译文

将当前主题转换为新模板和新的样式表单名称

原文

Switches current theme to new template and stylesheet names.

Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It's the same value that you'd use for a child theme, something like `twentythirteen`.) It also accepts an additional function signature of two arguments: $template then $stylesheet. This is for backwards compatibility.

switch_theme() 描述

用法

<?php switch_theme$stylesheet ?>Optional usage for backwards compatibility:<?php switch_theme$template$stylesheet ?>

switch_theme() 用法

参数

Current Parameters

$stylesheet

(string) (必填) Stylesheet name.

默认值: None

Alternate Function Signature Parameters for Backwards Compatibility

$template

(string) (必填) Template name.

默认值: None

$stylesheet

(string) (必填) Stylesheet name.

默认值: None

switch_theme() 参数

返回值

(void) 

This function does not return a value.

switch_theme() 返回值

注意

  • 使用到: do_action() 调用 'switch_theme' 动作 on updated theme display name.

switch_theme() 注意

历史

添加于 版本: 2.5.0

Altered 4/23 to define default/alternate function signature and 参数

switch_theme() 历史

源文件

switch_theme() 函数的代码位于 wp-includes/theme.php.

switch_theme() 源文件