epm_register_settings

Add settings sections and fields.

Description

epm_register_settings(); 

Usage

  1. if ( !function_exists( 'epm_register_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-peasy-mailchimp-ajax-form/includes/admin/settings/register-settings.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = epm_register_settings(); 
  7.  

Defined (1)

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

/includes/admin/settings/register-settings.php  
  1. function epm_register_settings() { 
  2.  
  3. if ( false == get_option( 'epm_settings' ) ) { 
  4. add_option( 'epm_settings' ); 
  5.  
  6. foreach( epm_get_registered_settings() as $tab => $settings ) { 
  7.  
  8. add_settings_section( 'epm_settings_' . $tab, __return_null(), '__return_false', 'epm_settings_' . $tab ); 
  9.  
  10. foreach ( $settings as $option ) { 
  11.  
  12. $name = isset( $option['name'] ) ? $option['name'] : ''; 
  13.  
  14. add_settings_field( 
  15. 'epm_settings[' . $option['id'] . ']',  
  16. $name,  
  17. function_exists( 'epm_' . $option['type'] . '_callback' ) ? 'epm_' . $option['type'] . '_callback' : 'epm_missing_callback',  
  18. 'epm_settings_' . $tab,  
  19. 'epm_settings_' . $tab,  
  20. array( 
  21. 'id' => isset( $option['id'] ) ? $option['id'] : null,  
  22. 'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',  
  23. 'name' => isset( $option['name'] ) ? $option['name'] : null,  
  24. 'section' => $tab,  
  25. 'size' => isset( $option['size'] ) ? $option['size'] : null,  
  26. 'options' => isset( $option['options'] ) ? $option['options'] : '',  
  27. 'std' => isset( $option['std'] ) ? $option['std'] : '' 
  28. ); 
  29.  
  30.  
  31. // Creates our settings in the options table 
  32. register_setting( 'epm_settings', 'epm_settings', 'epm_settings_sanitize' ); 
  33.