get_options_data

This function will return the value of saved theme options and other Runway specific data including extensions using core Runway data structures. The saved theme options created with the Options Builder can be retrieved with this function.

Sample use

<?php $value = get_options_data( $key, $option, $default ); ?>

Parameters

$key
(string) (required) The alias of the data set to retrieve. For example the Options Builder page alias can be entered here.
$option
(string) (optional) The alias of a single element within the $key data set. For example the alias of a single field in an Options Builder page.
Default: false
In more complex saved values containing array data you can specify a path within the array using a comma separated list. For example, an option containing the array below:

array(
  'books' => array( 'paperback' => 25, 'hardcover' => 11 ),
  'movies' => array( 'blu-ray' => 321, 'dvd' => 85, 'vhs' => 0 )
);

You might specifying an option value of 'movies,dvd' which would return the value 85.

$default
(mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database).
Default: null

Return values

Returns the current value for the specified option. If the specified option does not exist, returns $default or null.

If the $option parameter is not specified the full data set found for the $key will be returned.

Examples

<?php

// Value of single Options Builder field.
$link_color = get_options_data( 'design-settings', 'link-color' );

// Value of single field, with default.
$font_size = get_options_data( 'design-settings', 'font-size', '14px' );

// Get all values for Options Builder page.
$design_settings = get_options_data( 'design-settings' );

?>

Create a Note

Google+