Documentation

Everything you need to use WP Theme Options

Switch

Defining in the Array

To insert this component on the Theme Options you’ll need to put the following code in the file functions.array.php.

$fuse_options[] = array(
  'name' => __('Switch','textdomain'),
  'description' => __('Some description here (not mandatory)','textdomain'),
  'id' => 'themeoptions_switchID1',
  'std' => '',
  'type' => 'switch'
);

Or with custom text:

$fuse_options[] = array(
  'name' => __('Switch','textdomain'),
  'description' => __('Some description here (not mandatory)','textdomain'),
  'id' => 'themeoptions_switchID2',
  'on' => 'Enable',
  'off' => 'Disable',
  'std' => '',
  'type' => 'switch'
);

The values are always 0 or 1 (off/on), for std you should always use this values.

How to use on your theme

Make sure you already defined the global variable in the file you want to use the Theme Options values (without this it won’t return the values):

global $fuseData;

After this, you just need to call the unique ID, for example:

echo $fuseData['themeoptions_switchID1'];

Some ideas for you

This component can be used for multiple purposes, we highly recommend for this ones:

  • Hide or Show elements