Make Custom Background an Object Page
-
We want to move Appearance->Background so that it is on the main menu, here is the code I can up with but doesn’t seem to be working.
//======================================================= // Move WordPress Custom Background page //======================================================= function theme_admin_menu() { global $custom_background; if ( ! current_user_can('edit_theme_background') ) return; remove_action( 'admin_menu', array( $custom_background, 'custom_background' ) ); if ( current_theme_supports( 'custom-background' ) && is_admin() ) { $args = get_theme_support( 'custom-background' ); require_once( ABSPATH . 'wp-admin/custom-background.php' ); $custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); remove_submenu_page( 'themes.php', 'custom-background' ); $custom_background->page = $page = add_object_page(__('Background'), __('Background'), 'edit_theme_background', 'custom-background', array(&$custom_background, 'admin_page')); add_action("load-$page", array(&$custom_background, 'admin_load')); add_action("load-$page", array(&$custom_background, 'take_action'), 49); add_action("load-$page", array(&$custom_background, 'handle_upload'), 49); if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) { add_filter( 'attachment_fields_to_edit', array( $custom_background, 'attachment_fields_to_edit' ), 10, 2 ); add_filter( 'media_upload_tabs', array( $custom_background, 'filter_upload_tabs' ) ); add_filter( 'media_upload_mime_type_links', '__return_empty_array' ); } if ( $custom_background->admin_header_callback ) add_action("admin_head-$page", $custom_background->admin_header_callback, 51); } } // Finally we add our hook function add_action( 'wp_loaded', 'theme_admin_menu', 20 );
The topic ‘Make Custom Background an Object Page’ is closed to new replies.