本文整理汇总了PHP中add_theme_page函数的典型用法代码示例。如果您正苦于以下问题:PHP add_theme_page函数的具体用法?PHP add_theme_page怎么用?PHP add_theme_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_theme_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mytheme_add_admin
function mytheme_add_admin()
{
global $themename, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
update_option($value['id'], $_REQUEST[$value['id']]);
}
/*
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
else { delete_option( $value['id'] ); }
}
*/
header("Location: admin.php?page=themeset.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: admin.php?page=themeset.php&reset=true");
die;
}
}
}
add_theme_page($themename . " Options", $themename . "设置", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
示例2: add_appearance_menu
/**
* Add new menu in theme.php
*/
public function add_appearance_menu()
{
/**
* @link https://codex.wordpress.org/Function_Reference/add_theme_page
*/
add_theme_page(__('ItalyStrap Theme Options', 'ItalyStrap'), __('Theme Options', 'ItalyStrap'), $this->capability, 'italystrap-option-page', array($this, 'italystrap_callback_function'));
}
示例3: mytheme_add_admin
function mytheme_add_admin()
{
global $themename, $shortname, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($options as $value) {
if ($value['type'] != 'header') {
update_option($value['id'], $_REQUEST[$value['id']]);
}
}
foreach ($options as $value) {
if (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
} else {
delete_option($value['id']);
}
}
header("Location: themes.php?page=settings.php&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($options as $value) {
delete_option($value['id']);
}
header("Location: themes.php?page=settings.php&reset=true");
die;
}
}
}
add_theme_page($themename . " Settings", "Theme Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
示例4: addAdminPage
function addAdminPage()
{
// global $themename, $shortname, $options;
if ($_GET['page'] == basename(__FILE__)) {
if ('save' == $_REQUEST['action']) {
foreach ($this->options as $value) {
update_option($value['id'], $_REQUEST[$value['id']]);
}
foreach ($this->options as $value) {
if (isset($_REQUEST[$value['id']])) {
update_option($value['id'], $_REQUEST[$value['id']]);
} else {
delete_option($value['id']);
}
}
header("Location: themes.php?page=" . basename(__FILE__) . "&saved=true");
die;
} else {
if ('reset' == $_REQUEST['action']) {
foreach ($this->options as $value) {
delete_option($value['id']);
}
header("Location: themes.php?page=" . basename(__FILE__) . "&reset=true");
die;
}
}
}
add_theme_page($this->themename . " Options", $this->themename . " Options", 'edit_themes', basename(__FILE__), array(&$this, 'adminPage'));
}
示例5: hybrid_settings_page_init
/**
* Initializes all the theme settings page functionality. This function is used to create the theme settings
* page, then use that as a launchpad for specific actions that need to be tied to the settings page.
*
* @since 0.7.0
* @global string $hybrid The global theme object.
* @return void
*/
function hybrid_settings_page_init()
{
global $hybrid;
/* Get theme information. */
$theme = wp_get_theme(get_template(), get_theme_root(get_template_directory()));
$prefix = hybrid_get_prefix();
/* Register theme settings. */
register_setting("{$prefix}_theme_settings", "{$prefix}_theme_settings", 'hybrid_save_theme_settings');
/* Create the theme settings page. */
$hybrid->settings_page = add_theme_page(sprintf(esc_html__('%s Theme Settings', 'hybrid-core'), $theme->get('Name')), esc_html__('Theme Settings', 'hybrid-core'), hybrid_settings_page_capability(), 'theme-settings', 'hybrid_settings_page');
/* Check if the settings page is being shown before running any functions for it. */
if (!empty($hybrid->settings_page)) {
/* Filter the settings page capability so that it recognizes the 'edit_theme_options' cap. */
add_filter("option_page_capability_{$prefix}_theme_settings", 'hybrid_settings_page_capability');
/* Add help tabs to the theme settings page. */
add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_help');
/* Load the theme settings meta boxes. */
add_action("load-{$hybrid->settings_page}", 'hybrid_load_settings_page_meta_boxes');
/* Create a hook for adding meta boxes. */
add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_add_meta_boxes');
/* Load the JavaScript and stylesheets needed for the theme settings screen. */
add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_scripts');
add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_styles');
add_action("admin_footer-{$hybrid->settings_page}", 'hybrid_settings_page_load_scripts');
}
}
示例6: siteorigin_panels_admin_menu
/**
* Add the admin menu entries
*/
function siteorigin_panels_admin_menu()
{
if (!siteorigin_panels_setting('home-page')) {
return;
}
add_theme_page(__('Custom Home Page Builder', 'siteorigin-panels'), __('Home Page', 'siteorigin-panels'), 'edit_theme_options', 'so_panels_home_page', 'siteorigin_panels_render_admin_home_page');
}
示例7: test_menu_page_url
function test_menu_page_url() {
$current_user = get_current_user_id();
wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
update_option( 'siteurl', 'http://example.com' );
// add some pages
add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
$expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
$expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
$expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
$expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
$expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
$expected['not_registered'] = '';
$expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
$expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&page=testpages';
foreach ($expected as $name => $value) {
$this->assertEquals( $value, menu_page_url( $name, false ) );
}
wp_set_current_user( $current_user );
}
示例8: admin_menu
function admin_menu()
{
if (current_user_can('manage_options') || current_user_can($this->capability)) {
$plugin_page = add_theme_page('edit.php?post_type=csshortcode', __('Options', 'sws'), __('Options', 'sws'), 0, 'shortcode-options', array(&$this, 'shortcode_options'));
add_action('admin_head-' . $plugin_page, array(&$this, 'options_head'));
}
}
示例9: theme_options_add_page
/**
* Load up the menu page
*/
function theme_options_add_page()
{
add_theme_page(__('Takelage einstellen', 'piratenkleider'), __('Takelage einstellen', 'piratenkleider'), 'edit_theme_options', 'theme_options', 'theme_options_do_page');
add_theme_page(__('Segel setzen', 'piratenkleider'), __('Segel setzen', 'piratenkleider'), 'edit_theme_options', 'theme_defaultbilder', 'theme_defaultbilder_do_page');
add_theme_page(__('Captn & Crew', 'piratenkleider'), __('Captn & Crew', 'piratenkleider'), 'edit_theme_options', 'theme_kontaktinfos', 'theme_kontaktinfos_do_page');
add_theme_page(__('Klüverbaum', 'piratenkleider'), __('Klüverbaum', 'piratenkleider'), 'edit_theme_options', 'theme_designspecials', 'theme_designspecials_do_page');
}
示例10: admin_menu
function admin_menu()
{
// Add the theme page
add_theme_page(__('Maera Addons', 'maera'), __('Maera Addons', 'maera'), 'install_plugins', 'maera-ri', array($this, 'settings_page'));
// Remove the menu item for that page
remove_submenu_page('themes.php', 'maera-ri');
}
示例11: twentyeleven_theme_options_add_page
/**
* Add our theme options page to the admin menu, including some help documentation.
*
* This function is attached to the admin_menu action hook.
*
* @since Twenty Eleven 1.0
*/
function twentyeleven_theme_options_add_page() {
$theme_page = add_theme_page(
__( 'Theme Options', 'twentyeleven' ), // Name of page
__( 'Theme Options', 'twentyeleven' ), // Label in menu
'edit_theme_options', // Capability required
'theme_options', // Menu slug, used to uniquely identify the page
'theme_options_render_page' // Function that renders the options page
);
if ( ! $theme_page )
return;
$help = '<p>' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '</p>' .
'<ol>' .
'<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '</li>' .
'<li>' . __( '<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'twentyeleven' ) . '</li>' .
'<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site’s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '</li>' .
'</ol>' .
'<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>' .
'<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' .
'<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'twentyeleven' ) . '</p>' .
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>';
add_contextual_help( $theme_page, $help );
}
示例12: jr_mt_admin_hook
/**
* Add Admin Menu item for plugin
*
* Plugin needs its own Page in the Settings section of the Admin menu.
*
*/
function jr_mt_admin_hook()
{
// Add Settings Page for this Plugin
global $jr_mt_plugin_data;
add_theme_page($jr_mt_plugin_data['Name'], 'Multiple Themes plugin', 'switch_themes', 'jr_mt_settings', 'jr_mt_settings_page');
add_options_page($jr_mt_plugin_data['Name'], 'Multiple Themes plugin', 'switch_themes', 'jr_mt_settings', 'jr_mt_settings_page');
}
示例13: optionsframework_add_admin
/**
* Create Options page
*
* @uses add_theme_page()
* @uses add_action()
*
* @since 1.0.0
*/
function optionsframework_add_admin()
{
$of_page = add_theme_page(THEMENAME, 'Theme Options', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page');
// Add framework functionaily to the head individually
add_action("admin_print_scripts-{$of_page}", 'of_load_only');
add_action("admin_print_styles-{$of_page}", 'of_style_only');
}
示例14: et_pb_export_layouts_page
function et_pb_export_layouts_page()
{
add_theme_page(esc_html__('Export Page Builder Layouts', 'Divi'), esc_html__('Export Page Builder Layouts', 'Divi'), 'export', 'et_pb_export_layouts', 'et_pb_export_layouts_interface');
if (isset($_GET['page']) && 'et_divi_homepage_builder' === $_GET['page'] && isset($_POST['et_hb_action'])) {
et_homepage_builder_save_data();
}
}
示例15: sampression_theme_options
function sampression_theme_options()
{
$samp_menu = add_theme_page(__('Sampression Theme Option', 'sampression'), __('Theme Options', 'sampression'), 'edit_theme_options', 'sampression-options', 'sampression_build_options');
//$samp_menu = add_menu_page(__("Sampression Theme Options",'sampression'), __("Sampression",'sampression'), 'edit_theme_options', 'sampression-options', 'sampression_build_options');
add_action('admin_print_scripts-' . $samp_menu, 'sampression_admin_enqueue_scripts');
add_action('admin_print_styles-' . $samp_menu, 'sampression_admin_enqueue_styles');
}