Skip to content

Commit

Permalink
infinitely number of submenus issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
bassjobsen committed Oct 13, 2013
1 parent f84af73 commit 7e7141e
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 103 deletions.
2 changes: 2 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ function jbst_prepare_wrappers()

add_action( 'wp_head', 'jbst_prepare_wrappers',10);



/*
==========================================================
SAVE CUTOMIZER CSS TO FILE
Expand Down
47 changes: 46 additions & 1 deletion functions/template-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,54 @@ function skematik_grid_customizer_options($wp_customize) {
),
) );
}
add_action('skematik_add_to_customizer','skematik_customizer_mainnavigation');
function skematik_customizer_mainnavigation($wp_customize) {
global $wp_customize;
$wp_customize->add_section( 'nav', array(
'title' => __( 'Navigation' ),
'theme_supports' => 'menus',
'priority' => 100,
//'description' => sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.'),
'description' => __('Your theme supports menus. Select which menu you would like to use.') . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.')
) );


$wp_customize->add_setting( 'menu_depth', array(
'default' => 0,
) );

$wp_customize->add_control( 'menu_depth', array(
'label' => 'Depth, levels of submenus (default 0 = no submenus)',
'section' => 'nav',
//'type' => 'checkbox',
'priority' => 40,
) );

/* indicator clickable ? */
$wp_customize->add_setting( 'parent_clickable', array(
'default' => 0,
) );

$wp_customize->add_control( 'parent_clickable', array(
'label' => 'Should the parent (indicator) of a submenu be clickable?',
'section' => 'nav',
'type' => 'checkbox',
'priority' => 50,
) );

/* open on click? */
$wp_customize->add_setting( 'open_with_click', array(
'default' => 0,
) );

$wp_customize->add_control( 'open_with_click', array(
'label' => 'Open submenus on click (for mobile usage)',
'section' => 'nav',
'type' => 'checkbox',
'priority' => 60,
) );


}
/*
==================================================================
Navbar
Expand Down
2 changes: 1 addition & 1 deletion functions/template-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function widget($args, $instance)
echo $args['before_title'] . $instance['title'] . $args['after_title'];
global $wp_query;

wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'link_before' => '<i class="glyphicon glyphicon-chevron-right"></i>', 'menu_class' => 'nav skematik_custom_nav '.$show_info.' nav-stacked', 'walker' => new description_walker()) );
wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'link_before' => '<i class="glyphicon glyphicon-chevron-right"></i>', 'menu_class' => 'nav skematik_custom_nav '.$show_info.' nav-stacked', 'walker' => new wp_bootstrap_navwalker()) );

echo $args['after_widget'];
}
Expand Down
6 changes: 6 additions & 0 deletions library/assets/css/dropdown-submenu.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion library/assets/js/bootstrap.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions library/assets/js/open_with_click.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
jQuery('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
// Avoid following the href location when clicking
event.preventDefault();
// Avoid having the menu to close when clicking
event.stopPropagation();
// If a menu is already open we close it
jQuery('ul.dropdown-menu [data-toggle=dropdown]').parent().removeClass('open');
// opening the one you clicked on
jQuery(this).parent().addClass('open');
});
Loading

0 comments on commit 7e7141e

Please sign in to comment.