/** * function optionsframework_add_admin - Load static framework options pages * Credits to Devin too for using some coding from his framework https://github.com/devinsays */ function optionsframework_add_admin() { global $iva_options, $icon; /** * Save Options Settings */ if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework') { if (isset($_REQUEST['atp_save']) && 'reset' == $_REQUEST['atp_save']) { atp_reset_options($iva_options, 'optionsframework'); header("Location: admin.php?page=optionsframework&reset=true"); die; } } /** * Add a top level menu page in the 'objects' section * * @param string 'THEMENAME' The text to be displayed in the title tags of the page when the menu is selected * @param string 'THEMENAME' The text to be used for the menu * @param string 'edit_theme_options' The capability required for this menu to be displayed to the user. * @param string 'optionsframework' The slug name to refer to this menu by (should be unique for this menu) * @param callback 'optionsframework_options_page' The function to be called to output the content for this page. * @param string '$icon' The url to the icon to be used for this menu * * @return string The resulting page's hook_suffix */ if (function_exists('add_object_page')) { $icon = THEME_URI . '/framework/admin/images/theme-icon.png'; // Icon for theme admin menu add_object_page(THEMENAME, THEMENAME, 'edit_theme_options', 'optionsframework', 'optionsframework_options_page', $icon); } /** * Add a sub menu page * * @param string 'optionsframework' The slug name for the parent menu (or the file name of a standard WordPress admin page) * @param string 'THEMENAME' The text to be displayed in the title tags of the page when the menu is selected * @param string 'Theme Options' The text to be used for the menu * @param string 'edit_theme_options' The capability required for this menu to be displayed to the user. * @param string 'optionsframework' The slug name to refer to this menu by (should be unique for this menu) * @param callback 'optionsframework_options_page' The function to be called to output the content for this page. * * @return string|bool The resulting page's hook_suffix, or false if the user does not have the capability required. */ $atp_page = add_submenu_page('optionsframework', THEMENAME, 'Theme Options', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page'); // Default $advance = add_submenu_page('optionsframework', 'Advance', 'Import/Export', 'edit_theme_options', 'advance', 'optionsframework_options_page'); // Theme B /** * Hooks a function on to a specific action. * Runs in the HTML header so a admin framework can add JavaScript scripts to all admin pages. */ add_action("admin_print_scripts-{$atp_page}", 'atp_load_only'); add_action("admin_print_scripts-{$advance}", 'atp_load_only'); }
/** * function ivafw_optionsframework_add_admin - Load static framework options pages * Credits to Devin too for using some coding from his framework https://github.com/devinsays */ function ivafw_optionsframework_add_admin() { global $iva_of_options, $iva_icon; /** * Save Options Settings */ if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework') { if (isset($_REQUEST['atp_save']) && 'reset' == $_REQUEST['atp_save']) { atp_reset_options($iva_of_options, 'optionsframework'); header("Location: admin.php?page=optionsframework&reset=true"); die; } } /** * Add a top level menu page in the 'objects' section * * @param string 'THEMENAME' The text to be displayed in the title tags of the page when the menu is selected * @param string 'THEMENAME' The text to be used for the menu * @param string 'edit_theme_options' The capability required for this menu to be displayed to the user. * @param string 'optionsframework' The slug name to refer to this menu by $iva_sociable(should be unique for this menu) * @param callback 'optionsframework_options_page' The function to be called to output the content for this page. * @param string '$iva_icon' The url to the icon to be used for this menu * * @return string The resulting page's hook_suffix */ if (function_exists('add_object_page')) { $iva_icon = THEME_URI . '/framework/admin/images/aivah-icon.png'; // Icon for theme admin menu add_object_page(THEMENAME, THEMENAME, 'edit_theme_options', 'optionsframework', 'ivafw_optionsframework_options_page', $iva_icon); } /** * Hooks a function on to a specific action. * Runs in the HTML header so a admin framework can add JavaScript scripts to all admin pages. */ add_action("admin_print_scripts", 'atp_load_only'); }