add_theme_page 函数 在Wordpress后台侧边栏的【外观】下添加子菜单。
函数 add_pages_page 在内部调用的是
。函数源码:
function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}
可以看到,add_pages_page 比 add_submenu_page 就是固定了第一个参数,传入了:‘themes.php’。
使用举例:
function add_test_theme_page() {
add_theme_page( 'Theme Title Settings', 'Theme Menu Settings', 'edit_theme_options', 'test-theme-options', 'theme_option_page' );
}
add_action( 'admin_menu', 'add_test_theme_page' );
function theme_option_page() {
echo 'This is a test theme options page!';
}
-
WordPress函数:wp_delete_attachment 删除附件WordPress函数:wp_delete_attachment 删除评论
-
WordPress函数:wp_update_user 更新用户信息WordPress函数:wp_update_user 更新用户信息
-
WordPress函数:add_shortcode 添加短代码WordPress函数:add_shortcode 添加短代码
-
WordPress函数:remove_shortcode 删除短代码WordPress函数:remove_shortcode 删除短代码
-
WordPress函数:current_user_can_for_blog 多站点下检查用户权限WordPress函数:current_user_can_for_blog 多站点下检查用户权限
-
2款CMS小程序之追格资讯小程序(WordPress小程序)CMS一般指内容管理系统,内容管理系统(Content Management System,CMS),比如WordPress也是CMS系统,当然还有更多。
暂无评论,抢个沙发...