我可以通过代码设置wordpress主题吗
Can I set wordpress theme via code
我已经在 wordpress 上工作了一段时间。我知道我们可以通过管理面板管理主题,所选主题及其配置详细信息存储在数据库中。
有什么方法可以通过我的 wordpress 代码设置主题吗?
查看 Codex
上的 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.
用法
<?php switch_theme( $stylesheet ) ?>
我已经在 wordpress 上工作了一段时间。我知道我们可以通过管理面板管理主题,所选主题及其配置详细信息存储在数据库中。
有什么方法可以通过我的 wordpress 代码设置主题吗?
查看 Codex
上的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.
用法
<?php switch_theme( $stylesheet ) ?>