[Resolved] Remove Nav Class

Home Forums Support [Resolved] Remove Nav Class

Home Forums Support Remove Nav Class

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #679046
    Niklas

    Hi,

    i would like to use the mega menu. To make it work i need to remove the “main-navigation” class of the nav can you please tell me how to solve this?

    <nav itemtype="https://schema.org/SiteNavigationElement" itemscope="itemscope" id="site-navigation" class="main-navigation grid-container grid-parent"></nav>

    Thank you and best regards,
    Niklas

    #679108
    David
    Staff
    Customer Support

    Hi there,

    are you using a Mega Menu plugin?

    #679109
    Niklas

    Hi David,

    thanks for your reply.

    Yes, i am using the “megamenu” plugin. The support of that plugin told me to remove that class to solve my problem.
    I am not sure how to handle it.

    #679112
    David
    Staff
    Customer Support

    Little confused, i would assume the megamenu plugin should replace the GP Navigation entirely.
    What is the problem? Is the megamenu not displaying? Can you share a link to the site?

    #679118
    Niklas

    Hi David,

    That is the link of the site. I am using the woocommerce plugin as well and would like to put certain products into the mega menu. This is not working. But is does work, when you remove the class “main-navigation” class out of the nav element.

    BR
    Niklas

    #679127
    David
    Staff
    Customer Support

    As per the WP topic here:
    https://wordpress.org/support/topic/woocommerce-shortcodes-in-the-grid-layout/#post-10695125

    You would need to add this function. There are alternatives to using a child theme such as adding the code to the Code Snippets plugin:

    https://docs.generatepress.com/article/adding-php/

    #679913
    Niklas

    Hi David,

    thank you for the support but that doesn’t work.

    If I paste the code into the snippets plugin it says:

    The code snippet you are trying to save produced a fatal error on line 14:
    Cannot redeclare mega_menu_remove_main_navigation_class() (previously declared in /www/htdocs/w0135547/xxx/wp-content/plugins/megamenu-edit/megamenu-edit.php:13)

    Is there another way to remove that specific class?

    Regards,
    Niklas

    #679943
    Niklas

    Hi David,

    I could fix it by using that css code:

    .mega-menu-primary .main-navigation ul ul {
        height: auto;
        background: transparent;
        position: relative;
        left: auto;
        width: auto;
        box-shadow: none;
        pointer-events: auto;
        opacity: 1;
    }

    Thank you & regards,
    Niklas

    #680370
    Tom
    Lead Developer
    Lead Developer

    If you need to remove that class (not recommended), you can do this:

    add_filter( 'generate_navigation_class', function( $classes ) {
        $classes = array_diff( $classes, array( 'main-navigation' ) );
    
        return $classes;
    } );
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.