操作代码如下:
/**
* 名称:在Wordpress后台为新作的主题创建主题菜单
* 作者:原梓番
* 博客:http://www.yuanzifan.com/
* 最后修改:2019年12月6日
*/
add_action('admin_menu', 'add_theme_options_menu');
function add_theme_options_menu() {
add_theme_page(
'YZF主题设置', //页面title
'YZF主题设置', //后台菜单中显示的文字
'edit_theme_options', //选项放置的位置
'theme-options', //别名,也就是在URL中GET传送的参数
'theme_settings_admin' //调用显示内容调用的函数
);
}
function theme_settings_admin()
{
require get_template_directory()."/settings/options-framework.php";
}
需要你到主题目录下创建一个Settings,在下面创建一个options-framework.php的文件。在这个文件里写的东西,就可以做具体的设置。文章源自原紫番博客-https://www.yuanzifan.com/54524.html
效果如下:文章源自原紫番博客-https://www.yuanzifan.com/54524.html
文章源自原紫番博客-https://www.yuanzifan.com/54524.html
文章源自原紫番博客-https://www.yuanzifan.com/54524.html
站长微信
扫码添加(注明来意)
Yuanzifan99
原梓番博客公众号
博客内容精选
原梓番博客











评论