Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Settings API options initilization and validation
- function tdg_register_options(){
- require( get_template_directory() . '/inc/options-register.php' );
- }
- add_action('admin_init', 'tdg_register_options');
- [...]
- function tdg_cart_settings_display() {
- if ( ! current_user_can( 'manage_options' ) ) {
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
- } ?>
- <div class="wrap">
- <?php screen_icon('themes'); ?> <h2><?php _e('Cart Settings', 'tdg'); ?></h2>
- <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
- <div class='updated'><p><?php _e('Theme settings updated successfully.', 'tdg'); ?></p></div>
- <?php endif; ?>
- <form action="options.php" method="post">
- <?php settings_fields('theme_tdg_options'); // must be the same as the value in register_settings()
- require( get_template_directory() . '/inc/functions/options-cart.php' );
- do_settings_sections('tdg_cart_settings'); // must be the same as the $id in add_settings_section() ?>
- <p><?php submit_button('Save Changes', 'primary', 'theme_tdg_options[submit-cart]', false, '');
- submit_button('Reset Changes', 'delete', 'theme_tdg_options[reset-cart]', false, ''); ?></p>
- </form>
- </div>
- <?php }
- /**
- * theme options - settings page initialization
- *
- * @since 1.0.1
- */
- function tdg_setup_theme_admin_menus() {
- add_menu_page('Theme Settings', 'TDG Settings', 'manage_options', 'tdg_theme_settings', 'tdg_theme_settings_display', '', '2.3');
- add_submenu_page('tdg_theme_settings', 'Cart Settings', 'Cart Settings', 'manage_options', 'tdg_cart_settings', 'tdg_cart_settings_display');
- }
- add_action("admin_menu", "tdg_setup_theme_admin_menus");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement