Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
adding logic to Nav Style Options
Browse files Browse the repository at this point in the history
only display max mega menu if plugin is active.
  • Loading branch information
andrewmbacon committed Jun 24, 2015
1 parent 57d6a6b commit 75299f8
Showing 1 changed file with 34 additions and 20 deletions.
54 changes: 34 additions & 20 deletions inc/customizer-nav.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
<?php
$wp_customize->add_setting( 'navoption1', //Give it a SERIALIZED name (so all theme settings can live under one db record)
array(
'default' => 'drop', //Default setting/value to save
'type' => 'option', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);
$wp_customize->add_control('navoption1', array(
'type' => 'select',
'label' => 'Navigation Option 1',
'section' => 'nav',
'choices' => array(
'drop'=>'Dropdowns',
'drop-multi' => 'Multi-level Dropdowns',
'tabs'=>'Tabs',
'maxmegamenu'=>'Maxmegamenu Dropdown',
'left'=>'Left Only'
)
)
);
array(
'default' => 'drop', //Default setting/value to save
'type' => 'option', //Is this an 'option' or a 'theme_mod'?
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);


// Setup Navigation options as an array
$navStyleOptions = array(
'drop'=>'Dropdowns',
'drop-multi' => 'Multi-level Dropdowns',
'tabs'=>'Tabs'
);

// Check to see if max mega menu is active
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php');

// If it's active, add that option to the array.
if ($maxMegaMenuActive){
$navStyleOptions['maxmegamenu'] = 'Maxmegamenu Dropdown';
};

// create the nav style options using the array.
$wp_customize->add_control('navoption1', array(
'type' => 'select',
'label' => 'Navigation Style',
'section' => 'nav',
'choices' => $navStyleOptions
)
);

?>

0 comments on commit 75299f8

Please sign in to comment.