在wordpress主题中,您可以添加选项面板,您不能注册脚本或您可以添加的wp\\u enqueue\\u脚本
/*-----------------------------------------------------------*
/* THEME OPTION ADMIN PRINT SCRIPT EXAMPLE
/*-----------------------------------------------------------*/
add_action( \'admin_menu\', \'ease_print_script\' );
function ease_print_script() {
add_action( \'admin_print_scripts-\' . $ease_options_page, \'ease_print_scripts\' );
}
function ease_print_scripts() {
wp_enqueue_style( \'bootstrap\', get_template_directory_uri().\'/framework/css/bootstrap.css\');
wp_enqueue_style( \'bootstrap.vertical-tabs\', get_template_directory_uri().\'/framework/css/bootstrap.vertical-tabs.css\');
wp_enqueue_script( \'script\', get_template_directory_uri().\'/framework/js/script.js\');
wp_enqueue_script( \'bootstrap\', get_template_directory_uri().\'/framework/js/bootstrap.js\');
}
您的选项面板页面在此处创建了代码。。
/*-----------------------------------------------------------*
/* THEME OPTION PAGE
/*-----------------------------------------------------------*/
add_action( \'admin_init\', \'ease_add_options_1\' );
function ease_add_options_1() {
// Register new options
register_setting( \'ease_options\', \'ease_options\', \'ease_options_validate\' );
}
/*-----------------------------------------------------------*
/* THEME OPTION ADMIN IN MENU
/*-----------------------------------------------------------*/
add_action( \'admin_menu\', \'ease_add_page_1\' );
function ease_add_page_1() {
/**
* IF you want to add in wordpress == menu page OR add theme page ==
*/
// add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
// MENU PAGE
$ease_options_page = add_menu_page( \'__ease\', \'Theme Option\', \'manage_options\', \'__ease\', \'yout_code_here\' );
// THEME PAGE
// add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
// $ease_options_page = add_theme_page( \'ease\', \'Theme Option\', \'manage_options\', \'ease\', \'ease_options_page\' );
}
function yout_code_here(){
?>
<h2>Select Style</h2>
<form method="post" action="options.php">
<!--this option to wp_enqueue_style(\'style1\')-->
<label>
<input type="radio" name="myoption[radio1]" value="style1" />
<img src="//path-to-style1-img" /> Style1 </label>
<br />
<!--this option to wp_enqueue_style(\'style2\')-->
<label>
<input type="radio" name="myoption[radio1]" value="style2" />
<img src="//path-to-style2-img" /> Style2 </label>
<br />
<!--this option to wp_enqueue_style(\'style3\')-->
<label>
<input type="radio" name="myoption[radio1]" value="style3" />
<img src="path-to-style3-img" /> Style3 </label>
<br />
<?php submit_button(); ?>
</form>
<?php
}
wordpressoption-panel