Skip to content
visumdesignz edited this page Feb 22, 2013 · 3 revisions
<?php
echo $options['unique_id'];
?>

where unique_id is the id set for the field when creating the section fields.

Or you can use the Frameworks solution

The Framework comes with some functions which can be used to get the options, with you needing to remember the option name.

Just make sure when calling the class you assign it to a global var like so:

<?php
global $NHP_Options;
$NHP_Options = new NHP_Options($sections, $args);
?>

Then you can use the two built in functions for options display get(); and show();.

Using get, will "get" the option value from the main options array, so if you have a field with the id of "10", to get that option just call:

<?php
global $NHP_Options;
$option_val = $NHP_Options->get('10');
?>

To echo the option you can call the show function:

<?php
global $NHP_Options;
$NHP_Options->show('10');
?>

Note Using the show function on an array value (like multi select/checkbox values) will result in nothing being echoed.

Also if you would like to get the whole options array, just call the classes options var like so:

global $NHP_Options;
$options_array = $NHP_Options->options;

Note you only need to declare the global command once per script, ideally at the top of the file, then you would just call the functions wherever you need them.