Added menu description option for main menu

This commit is contained in:
kjodle 2016-02-26 11:33:17 -05:00
parent a1f515e0ae
commit e562483d85
2 changed files with 38 additions and 10 deletions

View File

@ -921,6 +921,20 @@ $default_copyright = '<a rel="license" href="http://creativecommons.org/licenses
'label' => __( 'Excerpt length in number of words (maximum = 100)', 'atticus-finch' ), 'label' => __( 'Excerpt length in number of words (maximum = 100)', 'atticus-finch' ),
) ); ) );
$wp_customize->add_setting( 'atticus_finch_main_menu_desc', array(
'type' => 'theme_mod',
'transport' => 'postMessage',
'default' => '1',
'sanitize_callback' => 'atticus_finch_sanitize_checkbox',
) );
$wp_customize->add_control( 'atticus_finch_main_menu_desc', array(
'section' => 'atticus_finch_misc',
'type' => 'checkbox',
'label' => __( 'Show menu item descriptions in main menu', 'atticus-finch' ),
) );
// Preview some of our options // Preview some of our options
/* /*
if ( $wp_customize->is_preview() && ! is_admin() ) if ( $wp_customize->is_preview() && ! is_admin() )

View File

@ -81,7 +81,9 @@
<?php $walker = new Atticus_Finch_Menu_With_Description; ?> <?php $walker = new Atticus_Finch_Menu_With_Description; ?>
<nav id="primary-menu"> <nav id="primary-menu">
<?php wp_nav_menu( array( <?php
if ( get_theme_mod( 'atticus_finch_main_menu_desc' ) == 1 ) {
$array = array(
'theme_location' => 'primary-menu', 'theme_location' => 'primary-menu',
'fallback_cb' => '', 'fallback_cb' => '',
'menu_class' => 'sf-menu', 'menu_class' => 'sf-menu',
@ -90,7 +92,19 @@
'container_id' => 'belowheadermenu', 'container_id' => 'belowheadermenu',
'depth' => 3, 'depth' => 3,
'walker' => $walker, 'walker' => $walker,
) ); );
} else {
$array = array(
'theme_location' => 'primary-menu',
'fallback_cb' => '',
'menu_class' => 'sf-menu',
'menu_id' => 'belowheadermenu-ul',
'container' => 'div',
'container_id' => 'belowheadermenu',
'depth' => 3,
);
}
wp_nav_menu( $array );
?> ?>
<div class="clear"></div> <div class="clear"></div>
</nav> </nav>