/** * upfw Theme Settings Page Markup * * @uses upfw_get_current_tab() defined in \functions\custom.php * @uses upfw_get_page_tab_markup() defined in \functions\custom.php */ function upfw_admin_options_page() { global $up_tabs; // Determine the current page tab $currenttab = upfw_get_current_tab(); // Define the page section accordingly $settings_section = 'upfw_' . $currenttab . '_tab'; ?> <div class="wrap"> <?php upfw_get_page_tab_markup(); ?> <?php if (isset($_GET['settings-updated'])) { echo '<div class="updated"><p>'; echo __('Theme settings updated successfully.', 'upfw'); echo '</p></div>'; } ?> <form action="options.php" method="post"> <?php // Implement settings field security, nonces, etc. settings_fields("theme_" . get_current_theme_id() . "_options"); // Output each settings section, and each // Settings field in each section do_settings_sections($settings_section); ?> <?php submit_button(__('Save Settings', 'upfw'), 'primary', "theme_" . get_current_theme_id() . "_options[submit-{$currenttab}]", false); ?> <?php submit_button(__('Reset Defaults', 'upfw'), 'secondary', "theme_" . get_current_theme_id() . "_options[reset-{$currenttab}]", false); ?> </form> </div> <?php }
/** * Define upfw Admin Page Tab Markup * * @uses upfw_get_current_tab() defined in \functions\options.php * @uses upfw_get_settings_page_tabs() defined in \functions\options.php * * @link http://www.onedesigns.com/tutorials/separate-multiple-theme-options-pages-using-tabs Daniel Tara */ function upfw_get_page_tab_markup() { global $up_tabs; $page = 'upfw-settings'; $current = upfw_get_current_tab(); if ('upfw-settings' == $page) { $tabs = $up_tabs; $links = array(); foreach ($tabs as $tab) { if (isset($tab['name'])) { $tabname = $tab['name']; } if (isset($tab['title'])) { $tabtitle = $tab['title']; } if ($tabname == $current) { $links[] = "<a class='nav-tab nav-tab-active' href='?page={$page}&tab={$tabname}'>{$tabtitle}</a>"; } else { $links[] = "<a class='nav-tab' href='?page={$page}&tab={$tabname}'>{$tabtitle}</a>"; } } echo '<div id="icon-themes" class="icon32"><br /></div>'; echo '<h2 class="nav-tab-wrapper">'; foreach ($links as $link) { echo $link; } echo '</h2>'; } }