twentyeleven_theme_options_add_page

Add a theme options page to the admin menu, including some help documentation.

Description

twentyeleven_theme_options_add_page(); 

This function is attached to the admin_menu action hook.


Usage

  1. if ( !function_exists( 'twentyeleven_theme_options_add_page' ) ) { 
  2. require_once '/inc/theme-options.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyeleven_theme_options_add_page(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/theme-options.php  
  1. function twentyeleven_theme_options_add_page() { 
  2. $theme_page = add_theme_page( 
  3. __( 'Theme Options', 'twentyeleven' ), // Name of page 
  4. __( 'Theme Options', 'twentyeleven' ), // Label in menu 
  5. 'edit_theme_options', // Capability required 
  6. 'theme_options', // Menu slug, used to uniquely identify the page 
  7. 'twentyeleven_theme_options_render_page' // Function that renders the options page 
  8. ); 
  9.  
  10. if ( ! $theme_page ) 
  11. return; 
  12.  
  13. $help = '<p>' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '</p>' . 
  14. '<ol>' . 
  15. '<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '</li>' . 
  16. '<li>' . __( '<strong>Link Color</strong>: You can choose the color used for text links on your site. You can enter the HTML color or hex code, or you can choose visually by clicking the "Select a Color" button to pick from a color wheel.', 'twentyeleven' ) . '</li>' . 
  17. '<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site’s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '</li>' . 
  18. '</ol>' . 
  19. '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>' . 
  20. '<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' . 
  21. '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'twentyeleven' ) . '</p>' . 
  22. '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>'; 
  23.  
  24. add_contextual_help( $theme_page, $help );