Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1624 and #1623: Bootstrap_Nav_Walker::start_el() continued #1625

Merged
merged 3 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This release contains bug fixes for Largo 0.6.

### Fixes

- Fixes PHP notices in class `Bootstrap_Walker_Nav_Menu`. [Pull request #1624](https:/INN/largo/pull/1624) for [issue #1623](https:/INN/largo/issues/1623) as part of [issue #1492](https:/INN/largo/issues/1492).
- Fixes PHP notices in class `Bootstrap_Walker_Nav_Menu`. [Pull request #1624](https:/INN/largo/pull/1624) and [#1625](https:/INN/largo/pull/1625) for [issue #1623](https:/INN/largo/issues/1623) as part of [issue #1492](https:/INN/largo/issues/1492).
- Fixes a regression in the behavior of the Largo Follow widget. [Pull request #1600](https:/INN/largo/pull/1600) for [issue #1599](https:/INN/largo/issues/1599).
- Fixes issue where post excerpt and featured media were not being used for open graph tags on post types that are `is_singular()` but not `is_single()`. [Pull request #1604)(https:/INN/largo/pull/1604) for [issue #1602](https:/INN/largo/issues/1602).
- Removes duplicate site title in opengraph tags for non-archive, non-`is_front_page()`, non-`is_singular()` URLs. [Pull request #1604](https:/INN/largo/pull/1604) for [issue #1602](https:/INN/largo/issues/1602).
Expand Down
16 changes: 7 additions & 9 deletions inc/nav-menus.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Output a donate button from theme options
* used by default in the global nav area
Expand Down Expand Up @@ -77,14 +76,13 @@ public function start_lvl( &$output, $depth = 0, $args = array() ) {
}

public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {

$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';

$li_attributes = '';
$class_names = $value = '';

$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = ( isset( $args['has_children'] ) && $args['has_children'] ) ? 'dropdown' : '';
$classes[] = ( isset( $args->has_children ) && $args->has_children ) ? 'dropdown' : '';
$classes[] = ($item->current || $item->current_item_ancestor) ? 'active' : '';
$classes[] = 'menu-item-' . $item->ID;

Expand All @@ -100,14 +98,14 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$attributes .= (( $args['has_children'] ) && ($depth == 0)) ? ' class="dropdown-toggle"' : '';
$attributes .= (( $args->has_children ) && ($depth == 0)) ? ' class="dropdown-toggle"' : '';

$item_output = $args['before'];
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>';
$item_output .= $args['link_before'] . apply_filters( 'the_title', $item->title, $item->ID ) . $args['link_after'];
$item_output .= ( ( $args['has_children'] ) && ($depth == 0)) ? ' <b class="caret"></b></a>' : '';
$item_output .= ( ( $args['has_children'] ) && ($depth != 0)) ? ' <i class="icon-arrow-right"></i></a>' : '</a>';
$item_output .= $args['after'];
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ( ( $args->has_children ) && ($depth == 0)) ? ' <b class="caret"></b></a>' : '';
$item_output .= ( ( $args->has_children ) && ($depth != 0)) ? ' <i class="icon-arrow-right"></i></a>' : '</a>';
$item_output .= $args->after;

$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
Expand Down