Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Move options menu item to top level and set it's position below Dashboard
- */
- add_action( 'admin_init', 'options_menu_item' );
- function options_menu_item() {
- if ( current_user_can( 'edit_theme_options' ) ) {
- global $menu;
- $icon_file = '/-files/gfx/options.png';
- $child_theme_icon = get_stylesheet_directory().$icon_file;
- $parent_theme_icon = get_template_directory().$icon_file;
- $default_icon = '';
- $child_theme_icon = file_exists( $child_theme_icon );
- $parent_theme_icon = file_exists( $parent_theme_icon );
- if( $child_theme_icon == TRUE ) {
- $icon = get_stylesheet_directory_uri().$icon_file;
- } elseif( $parent_theme_icon == TRUE ) {
- $icon = get_template_directory_uri().$icon_file;
- } else {
- $icon = $default_icon;
- }
- remove_submenu_page( 'themes.php', 'options-framework' );
- $options_page = add_menu_page( 'Options', 'Options', 'edit_theme_options', 'options-framework', 'optionsframework_page', $icon, 85 );
- add_action( 'admin_print_styles-' . $options_page, 'optionsframework_load_styles' );
- if( $_GET['page'] == 'options-framework' ) {
- // Enqueued scripts
- wp_enqueue_script('jquery-ui-core');
- wp_enqueue_script('color-picker', OPTIONS_FRAMEWORK_URL .'js/colorpicker.js', array('jquery'));
- wp_enqueue_script('options-custom', OPTIONS_FRAMEWORK_URL .'js/options-custom.js', array('jquery'));
- }
- $options_menu_item = $menu[85];
- unset( $menu[85] );
- $menu[3] = $options_menu_item;
- ksort( $menu );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement