[Support request] Lose Navigation Menu Labels when using DAP & has sub-menu items

Home Forums Support [Support request] Lose Navigation Menu Labels when using DAP & has sub-menu items

Home Forums Support Lose Navigation Menu Labels when using DAP & has sub-menu items

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #1446397
    Tom
    Lead Developer
    Lead Developer

    Well, I assumed it would install like a normal WordPress plugin, but it seems I was wrong.

    I just spent a while looking through their code but unfortunately I’m completely lost. The way they’ve hidden menu items is very complicated… I’m sure they have reasons for how they’ve done it, but it seems like it could be done with core WP filters instead.

    The only idea I have is to do something like this:

    add_action( 'wp', function() {
        $show_menu_items = Dap_Config::get("SHOW_PROT_MENULINKS");
    
        if ( 'N' === $show_menu_items ) {
            remove_filter( 'nav_menu_item_title', 'generate_dropdown_icon_to_menu_link', 10, 4 );
        }
    } );

    I have no idea if it will work or not, but it basically removes the filter that GeneratePress uses to add the dropdown arrows if that option is set to no.

    #1446413
    Bradley

    Do you need the install files and instructions to install it so you can do what you need to do and have a full working copy?

    Where would I copy that code to for testing purposes?

    #1446425
    Tom
    Lead Developer
    Lead Developer

    We could try that, although I’m not sure how helpful I can be here as their code is very difficult to understand.

    Let’s try my function first. You can add it using one of these methods: https://docs.generatepress.com/article/adding-php/

    #1446430
    Bradley

    Tried the code and it didn’t work.

    #1446434
    Bradley

    I take it back, I didn’t “Activate” the code. Am using Code Snippet.

    Now you see the label for menu options that are a pull-down menu, but the icon showing it’s a pull-down menu is gone. Looks like we’re very close.

    #1447458
    Tom
    Lead Developer
    Lead Developer

    I’m afraid I’m not sure what the complete solution is here, unfortunately.

    The filter we’re using (nav_menu_item_title) is a core WordPress filter, and we’re using it correctly.

    I’m not sure what DAP is doing when it’s filtering the menu items, but they’re not using core filters to do so.

    While they say it’s a theme conflict, I believe the same conflict will happen with their plugin with any theme or plugin that uses the nav_menu_item_title filter. It’s something they should definitely want to look into or at least test.

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.