Everything you need to use WP Theme Options

Grouped Hidden Components

Grouped and Hidden

Defining in the Array

First you need to create a new checkbox, then add the ‘folds’ => 1, it’s important to make sure that you only have one label and one value (1).

$fuse_options[] = array(
  'name' => __('Show Hidden Components','textdomain'),
  'description' => __('Some description here (not mandatory)','textdomain'),
  'id' => 'themeoptions_foldcheckbox',
  'std' => '',
  'type' => 'checkbox',
  'folds' => 1,
  'options' => array(
    'labels' => array('Click here to show the hidden components.'),
    'values' => array('1')

Then create the hidden components using the option ‘fold’ => ‘themeoptions_foldcheckbox’, the value should be the checkbox id.

$fuse_options[] = array(
  'name' => __('Text Hidden Component','textdomain'),
  'description' => __('Some description here (not mandatory)','textdomain'),
  'id' => 'themeoptions_textHidden',
  'std' => '',
  'type' => 'text',
  'fold' => 'themeoptions_foldcheckbox'

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:

if($fuseData['themeoptions_foldcheckbox'] == 1) {
  echo $fuseData['themeoptions_textHidden'];

Some ideas for you

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

  • Hide and show configurations from the Theme
  • Show the map and use components for latitude/longitude
  • Activate contact form and show configurations