docs/files/class-my-theme-kirki.php
public static function get_option( $config_id = '', $field_id = '' ) {

		// if Kirki exists, use it.
		if ( class_exists( 'Kirki' ) ) {
			return Kirki::get_option( $config_id, $field_id );
		}

		// Kirki does not exist, continue with our custom implementation.
		// Get the default value of the field.
		$default = '';
		if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) {
			$default = self::$fields[ $field_id ]['default'];
		}

		// Make sure the config is defined.
		if ( isset( self::$config[ $config_id ] ) ) {
			if ( 'option' === self::$config[ $config_id ]['option_type'] ) {

				// check if we're using serialized options.
				if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) {

					// Get all our options.
					$all_options = get_option( self::$config[ $config_id ]['option_name'], array() );

					// If our option is not saved, return the default value.
					// If option was set, return its value unserialized.
					return ( ! isset( $all_options[ $field_id ] ) ) ? $default : maybe_unserialize( $all_options[ $field_id ] );
				}

				// If we're not using serialized options, get the value and return it.
				// We'll be using a dummy default here to check if the option has been set or not.
				// We'll be using md5 to make sure it's randomish and impossible to be actually set by a user.
				$dummy = md5( $config_id . '_UNDEFINED_VALUE' );
				$value = get_option( $field_id, $dummy );

				// setting has not been set, return default.
				return ( $dummy === $value ) ? $default : $value;
			}

			// We're not using options so fallback to theme_mod.
			return get_theme_mod( $field_id, $default );
		}
	}
public static function get_option( $config_id = '', $field_id = '' ) {

		// if Kirki exists, use it.
		if ( class_exists( 'Kirki' ) ) {
			return Kirki::get_option( $config_id, $field_id );
		}

		// Kirki does not exist, continue with our custom implementation.
		// Get the default value of the field.
		$default = '';
		if ( isset( self::$fields[ $field_id ] ) && isset( self::$fields[ $field_id ]['default'] ) ) {
			$default = self::$fields[ $field_id ]['default'];
		}

		// Make sure the config is defined.
		if ( isset( self::$config[ $config_id ] ) ) {
			if ( 'option' === self::$config[ $config_id ]['option_type'] ) {

				// check if we're using serialized options.
				if ( isset( self::$config[ $config_id ]['option_name'] ) && ! empty( self::$config[ $config_id ]['option_name'] ) ) {

					// Get all our options.
					$all_options = get_option( self::$config[ $config_id ]['option_name'], array() );

					// If our option is not saved, return the default value.
					// If option was set, return its value unserialized.
					return ( ! isset( $all_options[ $field_id ] ) ) ? $default : maybe_unserialize( $all_options[ $field_id ] );
				}

				// If we're not using serialized options, get the value and return it.
				// We'll be using a dummy default here to check if the option has been set or not.
				// We'll be using md5 to make sure it's randomish and impossible to be actually set by a user.
				$dummy = md5( $config_id . '_UNDEFINED_VALUE' );
				$value = get_option( $field_id, $dummy );

				// setting has not been set, return default.
				return ( $dummy === $value ) ? $default : $value;
			}

			// We're not using options so fallback to theme_mod.
			return get_theme_mod( $field_id, $default );
		}
	}
public static function get_option ( $ config_id = '' , $ field_id = '' ) { // if Kirki exists, use it. if ( class_exists ( 'Kirki' ) ) { return Kirki :: get_option ( $ config_id , $ field_id ) ; } // Kirki does not exist, continue with our custom implementation. // Get the default value of the field. $ default = '' ; if ( isset ( self :: $ fields [ $ field_id ] ) && isset ( self :: $ fields [ $ field_id ] [ 'default' ] ) ) { $ default = self :: $ fields [ $ field_id ] [ 'default' ] ; } // Make sure the config is defined. if ( isset ( self :: $ config [ $ config_id ] ) ) { if ( 'option' === self :: $ config [ $ config_id ] [ 'option_type' ] ) { // check if we're using serialized options. if ( isset ( self :: $ config [ $ config_id ] [ 'option_name' ] ) && ! empty ( self :: $ config [ $ config_id ] [ 'option_name' ] ) ) { // Get all our options. $ all_options = get_option ( self :: $ config [ $ config_id ] [ 'option_name' ] , array ( ) ) ; // If our option is not saved, return the default value. // If option was set, return its value unserialized. return ( ! isset ( $ all_options [ $ field_id ] ) ) ? $ default : maybe_unserialize ( $ all_options [ $ field_id ] ) ; } // If we're not using serialized options, get the value and return it. // We'll be using a dummy default here to check if the option has been set or not. // We'll be using md5 to make sure it's randomish and impossible to be actually set by a user. $ dummy = md5 ( $ config_id . '_UNDEFINED_VALUE' ) ; $ value = get_option ( $ field_id , $ dummy ) ; // setting has not been set, return default. return ( $ dummy === $ value ) ? $ default : $ value ; } // We're not using options so fallback to theme_mod. return get_theme_mod ( $ field_id , $ default ) ; } }
Get the value of an option from the db.

@param string $config_id The ID of the configuration corresponding to this field.
@param string $field_id  The field_id (defined as 'settings' in the field arguments).
@return mixed            The saved value of the field.
Get the value of an option from the db .