Yoda conditions

This commit is contained in:
Gary Kealy 2019-07-18 16:48:04 +01:00
parent c2a06502b7
commit bc3c4cb375
3 changed files with 2 additions and 3 deletions

View File

@ -189,7 +189,7 @@ if ( ! class_exists( 'Understrap_WP_Bootstrap_Navwalker' ) ) {
} }
// If item has_children add atts to <a>. // If item has_children add atts to <a>.
if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && $args->depth !== 1 ) { if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && 1 !== $args->depth ) {
$atts['href'] = '#'; $atts['href'] = '#';
$atts['data-toggle'] = 'dropdown'; $atts['data-toggle'] = 'dropdown';
$atts['aria-haspopup'] = 'true'; $atts['aria-haspopup'] = 'true';

View File

@ -27,7 +27,7 @@ if ( ! function_exists( 'understrap_slbd_count_widgets' ) ) {
if ( isset( $sidebars_widgets_count[ $sidebar_id ] ) ) : if ( isset( $sidebars_widgets_count[ $sidebar_id ] ) ) :
$widget_count = count( $sidebars_widgets_count[ $sidebar_id ] ); $widget_count = count( $sidebars_widgets_count[ $sidebar_id ] );
$widget_classes = 'widget-count-' . count( $sidebars_widgets_count[ $sidebar_id ] ); $widget_classes = 'widget-count-' . count( $sidebars_widgets_count[ $sidebar_id ] );
if ( $widget_count % 4 == 0 || $widget_count > 6 ) : if ( 0 == $widget_count % 4 || $widget_count > 6 ) :
// Four widgets per row if there are exactly four or more than six // Four widgets per row if there are exactly four or more than six
$widget_classes .= ' col-md-3'; $widget_classes .= ' col-md-3';
elseif ( 6 == $widget_count ) : elseif ( 6 == $widget_count ) :

View File

@ -26,7 +26,6 @@
<!-- Use the WordPress Ruleset --> <!-- Use the WordPress Ruleset -->
<rule ref="WordPress"> <rule ref="WordPress">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/> <exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd"/> <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd"/>
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed"/> <exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed"/>
<exclude name="WordPress.Security.EscapeOutput.UnsafePrintingFunction"/> <exclude name="WordPress.Security.EscapeOutput.UnsafePrintingFunction"/>