of_get_option

The SKT Biz of get option function.

Description

of_get_option( (string) $name, (bool) $default = false ); 

Parameters (2)

0. $name (string)
The name.
1. $default — Optional. (bool) => false
The default.

Usage

  1. if ( !function_exists( 'of_get_option' ) ) { 
  2. require_once '/inc/options-framework.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // The default. 
  8. $default = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = of_get_option($name, $default); 
  12.  

Defined (1)

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

/inc/options-framework.php  
  1. function of_get_option( $name, $default = false ) { 
  2.  
  3. $option_name = ''; 
  4.  
  5. // Gets option name as defined in the theme 
  6. if ( function_exists( 'optionsframework_option_name' ) ) { 
  7. $option_name = optionsframework_option_name(); 
  8.  
  9. // Fallback option name 
  10. if ( '' == $option_name ) { 
  11. $option_name = get_option( 'stylesheet' ); 
  12. $option_name = preg_replace( "/\W/", "_", strtolower( $option_name ) ); 
  13.  
  14. // Get option settings from database 
  15. $options = get_option( $option_name ); 
  16.  
  17. // Return specific option 
  18. if ( isset( $options[$name] ) ) { 
  19. return $options[$name]; 
  20.  
  21. return $default;