1111 * Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
1212 * Description: A custom WordPress nav walker class to implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.
1313 * Author: Edward McIntyre - @twittem, WP Bootstrap, William Patton - @pattonwebz
14- * Version: 4.0.3
14+ * Version: 4.1.0
1515 * Author URI: https://github.com/wp-bootstrap
1616 * GitHub Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
1717 * GitHub Branch: master
@@ -405,7 +405,7 @@ private function seporate_linkmods_and_icons_from_classes( $classes, &$linkmod_c
405405 // Test for .disabled or .sr-only classes.
406406 $ linkmod_classes [] = $ class ;
407407 unset( $ classes [ $ key ] );
408- } elseif ( preg_match ( '/^dropdown-header|^dropdown-divider/i ' , $ class ) && $ depth > 0 ) {
408+ } elseif ( preg_match ( '/^dropdown-header|^dropdown-divider|^dropdown-item-text /i ' , $ class ) && $ depth > 0 ) {
409409 // Test for .dropdown-header or .dropdown-divider and a
410410 // depth greater than 0 - IE inside a dropdown.
411411 $ linkmod_classes [] = $ class ;
@@ -446,6 +446,8 @@ private function get_linkmod_type( $linkmod_classes = array() ) {
446446 $ linkmod_type = 'dropdown-header ' ;
447447 } elseif ( 'dropdown-divider ' === $ link_class ) {
448448 $ linkmod_type = 'dropdown-divider ' ;
449+ } elseif ( 'dropdown-item-text ' === $ link_class ) {
450+ $ linkmod_type = 'dropdown-item-text ' ;
449451 }
450452 }
451453 }
@@ -477,7 +479,7 @@ private function update_atts_for_linkmod_type( $atts = array(), $linkmod_classes
477479 // Convert link to '#' and unset open targets.
478480 $ atts ['href ' ] = '# ' ;
479481 unset( $ atts ['target ' ] );
480- } elseif ( 'dropdown-header ' === $ link_class || 'dropdown-divider ' === $ link_class ) {
482+ } elseif ( 'dropdown-header ' === $ link_class || 'dropdown-divider ' === $ link_class || ' dropdown-item-text ' === $ link_class ) {
481483 // Store a type flag and unset href and target.
482484 unset( $ atts ['href ' ] );
483485 unset( $ atts ['target ' ] );
@@ -515,7 +517,9 @@ private function wrap_for_screen_reader( $text = '' ) {
515517 */
516518 private function linkmod_element_open ( $ linkmod_type , $ attributes = '' ) {
517519 $ output = '' ;
518- if ( 'dropdown-header ' === $ linkmod_type ) {
520+ if ( 'dropdown-item-text ' === $ linkmod_type ) {
521+ $ output .= '<span class="dropdown-item-text" ' . $ attributes . '> ' ;
522+ } elseif ( 'dropdown-header ' === $ linkmod_type ) {
519523 // For a header use a span with the .h6 class instead of a real
520524 // header tag so that it doesn't confuse screen readers.
521525 $ output .= '<span class="dropdown-header h6" ' . $ attributes . '> ' ;
@@ -537,7 +541,7 @@ private function linkmod_element_open( $linkmod_type, $attributes = '' ) {
537541 */
538542 private function linkmod_element_close ( $ linkmod_type ) {
539543 $ output = '' ;
540- if ( 'dropdown-header ' === $ linkmod_type ) {
544+ if ( 'dropdown-header ' === $ linkmod_type || ' dropdown-item-text ' === $ linkmod_type ) {
541545 // For a header use a span with the .h6 class instead of a real
542546 // header tag so that it doesn't confuse screen readers.
543547 $ output .= '</span> ' ;
0 commit comments