Home » Php » html – How to remove menu header in php?

html – How to remove menu header in php?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have menu header in my php that I’d like to remove.How?

PHP:

if ( ! empty( $item->attr_title ) ) {
            $item_output .= '<a' . $attributes . '><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span>&nbsp;';
        } else {
            $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 ) ? ' </a><span class="dropdown-toggle shapely-dropdown" data-toggle="dropdown"><i class="fa fa-angle-down" aria-hidden="true"></i></span>' : '</a>';
        $item_output .= $args->after;

        $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
    }// End if().
}

HTML Output:

<div class="collapse navbar-collapse navbar-ex1-collapse"><ul id="menu" class="menu"><li id="menu-item-3530" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-3530 dropdown"><a title="Contact" href="https://4309.co.uk/contact/">Contact </a><span class="dropdown-toggle shapely-dropdown" data-toggle="dropdown"><i class="fa fa-angle-down"  aria-hidden="true"></i></span>

The header menu item is contact along with fa-angle-down

Or could this be achieved with CSS? Tried.fa-angle-down {display: none;}and.menu-item-3530 {display:none;} but it doesn’t do what I want-namely getting menu to go from bars to menu whilst not displaying contact header item.

Please see here for full navwalker.php https://github.com/ColorlibHQ/shapely/blob/master/inc/class-wp-bootstrap-navwalker.php

And here for my header.php https://github.com/ColorlibHQ/shapely/blob/master/header.php

Please see page here

This seems to be an issue not just with Shapely Theme, but that WordPress puts header menu item by default.

Does it have anything to do with aria-hidden?https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-hidden_attribute

How to&Answers:

It’s your theme. It’s set up to show a hamburger icon for the menu for all screen sizes.

@media (min-width: 992px)

This statement makes it true for a desktop. And on top of that, the icon is defined as a child of a flex item, which means you can’t just set display: none. that doesn’t work with flex.

I did get rid of the icon by overriding flex with inline: block, then setting display: none on the icon, but the menu still doesn’t show up.

My recommendation: change themes.