Site logo

[Resolved] menu doesn’t work with custom links removing #

Home Forums Support [Resolved] menu doesn’t work with custom links removing #

Home Forums Support menu doesn’t work with custom links removing #

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #2423436
    Yohann

    Hello,
    I use custom links to create title in my menu and I remove the #
    in off Canva menu, when you click on the title , it immediately close the off Canva menu.
    Would you know how we could fix it ?
    Thank you very much.

    #2423927
    David
    Staff
    Customer Support

    Hi there,

    can i see the site with the issue ?

    #2425110
    Yohann
    #2425219
    David
    Staff
    Customer Support

    Is this for the Menu Items with the Icon that have no link?

    If yes, then for each of those menu items, give them a CSS class of no-pointers
    This doc show how to add the CSS Class:

    https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#custom-classes

    Then add this CSS to your site:

    
    .no-pointers {
        pointer-events: none;
    }

    That will make those items “unclickable” so the script wont fire if you do click them.

    For the menu items with sub menus those need to have the # URL.

    #2430647
    Yohann

    Thank you for your answer. but I want to reduce the links on my page for SEO, and when I use # I automatically create links. Is there a way to change the script like this it won’t fire anymore and I won’t have # in links ?
    if I use other themes it works well(for example twenty-one).
    So it comes from generatepress. I have a child theme.

    Thank you for your help.

    #2430689
    David
    Staff
    Customer Support

    Remove the URLs, and try adding this CSS:

    
    .menu-item-has-children a:not([href]) {
        pointer-events: none;
        position: relative;
    }
    .menu-item-has-children a:not([href]) .dropdown-menu-toggle {
        pointer-events: auto;
        cursor: pointer;
        position: absolute;
        left: 0;
        right:0;
        text-align: right;
    }
    
    
    #2430875
    Yohann

    Excellent ! this is perfect
    Thank you so much

    #2430879
    David
    Staff
    Customer Support

    Glad to be of help

    #2449505
    Yohann

    I am sorry to come back but there is a trouble with your solution.
    I have obfusq the link in the menu, and with your solution they don’t work…
    So I ask you again my first question…
    Thank you for your help.

    #2449672
    Fernando
    Customer Support

    Hi Yohann,

    For clarity, can you rephrase “I have obfusq the link in the menu”?

    If you’re referring to “VOS BESOINS” for instance, can you try David’s suggestion here: https://generatepress.com/forums/topic/menu-doesnt-work-with-custom-links-removing/#post-2425219

    #2449893
    Yohann

    I mean I have use obfuscation to hide links …
    But when I use the last solution, the obfuscated links doesn’t work

    And when I use the first solution, I have too much links /#

    If I use the theme twenty one for example, you can easily remove /# and the menu doesn’t close when I click on custom links without #

    How can we fix it please ?
    Thank you

    #2450084
    David
    Staff
    Customer Support

    How are you obfuscating the links ?

    #2450096
    Yohann

    I use a plug-in obf-link
    It works well with other themes

    #2450176
    David
    Staff
    Customer Support

    I am not sure there is an easy fix for that, as GP filters in the Sub Menu using the same filters that plugin will. So it will break the sub menu.

    Do you need to obfuscate the links with the option i provided here:

    https://generatepress.com/forums/topic/menu-doesnt-work-with-custom-links-removing/#post-2430689

    #2458184
    Yohann

    With this piece of CSS, all the links are obfuscated but we cannot open them…
    I need to obfuscate most of those links but not all… With the plugin it is very easy to manage. But maybe we could had a class or something to select the one who will be obfuscated.

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.