of_get_option
The Onetone of get option function.
Description
Parameters (2)
- 0. $name (string)
- The name.
- 1. $default — Optional. (bool) =>
false
- The default.
Usage
if ( !function_exists( 'of_get_option' ) ) { require_once '/admin/options-framework.php'; } // The name. $name = ''; // The default. $default = false; // NOTICE! Understand what this does before running. $result = of_get_option($name, $default);
Defined (1)
The function is defined in the following location(s).
- /admin/options-framework.php
- function of_get_option( $name, $default = false ) {
- $option_name = '';
- // Gets option name as defined in the theme
- if ( function_exists( 'optionsframework_option_name' ) ) {
- $option_name = optionsframework_option_name();
- }
- // Fallback option name
- if ( '' == $option_name ) {
- $option_name = get_option( 'stylesheet' );
- $option_name = preg_replace( "/\W/", "_", strtolower( $option_name ) );
- }
- // Get option settings from database
- $options = get_option( $option_name );
- // Return specific option
- if ( isset( $options[$name] ) ) {
- return $options[$name];
- }
- return $default;
- }