optionsframework_init

Creates the settings in the database by looping through the array we supplied in options.

Description

optionsframework_init(); 

This is a neat way to do it since we won't have to save settings for headers, descriptions, or arguments.

Read more about the Settings API in the WordPress codex: http://codex.wordpress.org/Settings_API


Usage

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

Defined (1)

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

/admin/options-framework/options-framework.php  
  1. function optionsframework_init() { 
  2.  
  3. // Include the required files 
  4. require_once dirname( __FILE__ ) . '/options-interface.php'; 
  5. require_once dirname( __FILE__ ) . '/options-medialibrary-uploader.php'; 
  6.  
  7. // Loads the options array from the theme 
  8. if ( $optionsfile = locate_template( array('options.php') ) ) { 
  9. require_once($optionsfile); 
  10. else if (file_exists( dirname( __FILE__ ) . '/options.php' ) ) { 
  11. require_once dirname( __FILE__ ) . '/options.php'; 
  12.  
  13. $optionsframework_settings = get_option('optionsframework' ); 
  14.  
  15. // Updates the unique option id in the database if it has changed 
  16.  
  17. // Gets the unique id, returning a default if it isn't defined 
  18. if ( isset($optionsframework_settings['id']) ) { 
  19. $option_name = $optionsframework_settings['id']; 
  20. else { 
  21. $option_name = 'optionsframework'; 
  22.  
  23. // If the option has no saved data, load the defaults 
  24. if ( ! get_option($option_name) ) { 
  25.  
  26. // Registers the settings fields and callback 
  27. register_setting( 'optionsframework', $option_name, 'optionsframework_validate' ); 
  28.  
  29. // Change the capability required to save the 'optionsframework' options group.