[Resolved] Button on secondary menu not working

Home Forums Support [Resolved] Button on secondary menu not working

Home Forums Support Button on secondary menu not working

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1206531
    johnaps

    Hello!

    (1) As a logged user the button shown in the image bellow isnt working by simple click…
    If you right click it and select to open in a new tab it opens as it should…

    View post on imgur.com

    I am trying to solve this quite some time now? Do you have any input that might help me?

    If you create an account you can see it cause its an element on the secondary menu visible only to logged in users!

    (2) Also as you can see on the cart icon for some reason when you have 0 items it shows 2 zeros instead of 1…
    That change was made byitself and through inspecting the css i didnt find any solution (Any thoughts on that also?)

    Thank you in advance! 🙂

    #1206622
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you create an account for us and send the details via the contact form?: https://generatepress.com/contact

    Be sure to mention this topic.

    Also, can you deactivate any caching/minifying plugins while we debug – the CSS right now is difficult to look through.

    Thanks!

    #1207717
    Tom
    Lead Developer
    Lead Developer

    Strange, not seeing anything obvious.

    You do have a javascript error you should fix: Uncaught ReferenceError: grecaptcha is not defined

    The javascript is minified, so I’m not able to see where it’s coming from.

    It looks like the button is a simple HTML link, so not sure what’s preventing the click event from firing. I’m assuming there’s some broken javascript somewhere.

    First, I would fix that javascript error.

    If that doesn’t work, I would deactivate your plugins one by one to see if one of them is breaking the link.

    #1207858
    johnaps

    I am sorry Tom, i hadnt disabled wp rocket…

    I did now… i fixed the js error by enabling captcha on script manager by perfmatters! And still the same so i redisabled that js cause i dont want it to load on front page.
    I ll try to disable some plugins to see if its coming from there

    #1207870
    johnaps

    I have test/disabled all plugins except woocommerce(which didnt let me disable test it cause of site crash) and premmerce permalink manager cause of termorary change on my permalinks could hurt my seo…
    Still facing same issue without having found what is causing it… :/

    I can give admin creds if needed…

    #1207907
    johnaps

    i activated sitehealth plugin by wordpress and saw the following errors…
    i deactivated perfmatters first…

    1. rest api had a problem
    cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received

    2. imagick isnt activated or installed

    3. We cant confirm that the filter wp_version_check() is available.

    4. You site doesnt have a default theme ( i have gp child activated and all my themes are gp child and gp)

    i also did check files integrity and found the following files that are modified

    /public/wp-includes/version.php
    /wp-includes/css/dist/block-library/style.css (this maybe i have done it with a service that reducts unused css (unused-css.com))

    it instructed me to reinstall wordpress for fixing the files but i dont want to do that,if it isnt necessary, due to customization i may have done to various css on wordpress for performance …

    #1207927
    Tom
    Lead Developer
    Lead Developer

    I’m still seeing the javascript error on my end.

    Besides that, I’m not really sure what could be causing this. Are any other links broken? My best guess is there is javascript somewhere preventing links from executing (e.preventDefault()).

    #1209428
    johnaps

    As i mentioned above the js error has nothing to do with it… It comes from grecaptcha.js which i have disabled through a script manager plugin… I enabled it when you first mentioned it, so to test this wasnt causing the problem and it isnt… I of course have disabled each and every plugin so i can check any plugin was the cause, and i have ruled them all out…

    I am thinking of 2 ways that ‘ll maybe help me solve this, if you can share your input on their usefulness…

    1. maybe with some update on theme, woocommerce, wordpress… my script for getting the logged in user name, which the problematic button of ours shows, has stopped working…
    my script is the following, maybe you ll see something i am missing…

    function give_profile_name($atts){
        $user=wp_get_current_user();
        $name=$user->user_firstname; 
        return $name;
    }
    
    add_shortcode('profile_name', 'give_profile_name');
    
    add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' );
    function my_dynamic_menu_items( $menu_items ) {
        foreach ( $menu_items as $menu_item ) {
            if ( strpos($menu_item->title, '#profile_name#') !== false) {
                    $menu_item->title =  str_replace("#profile_name#",  wp_get_current_user()->user_firstname, $menu_item->title);
            }
        }
    
        return $menu_items;
    }

    2. second option to solve maybe will be if i make the button a dropdown menu somehow which contains other buttons? maybe the dropdown menu buttons will work and i ‘ll get the same functionality…
    (a dropdown menu maybe like amazons? https://imgur.com/a/zmnT0qw )
    can you remind me how i can do this? (do you think the dropdown buttons will work?). I had done THIS before i just dont remember how i did it then…

    Thank you for bearing with me!!

    #1210167
    Tom
    Lead Developer
    Lead Developer

    Why does the menu item have a sub-menu? What happens if you remove it?

    #1210191
    johnaps

    That was the culprit! Thank you Tom!!

    Can you reference me for future use how to correctly make a button open on hover a submenu with other menu items in it?

    #1210979
    Tom
    Lead Developer
    Lead Developer

    Not too sure what you mean. Are you wanting to create a sub-menu using a function (without going into “Appearance > Menus”)?

    #1211016
    johnaps

    i want to make a submenu that opens when your hover over the button we talked about! If i created through “Appearance > Menus” then i cant get that hoverable functionality (and more importantly i cant get a submenu to show at all)…

    #1211360
    Tom
    Lead Developer
    Lead Developer

    Right now your “Navigation Dropdown” option in Customize > Layout > Primary Navigation is set to “Click – Menu Item”.

    That’s why nothing was happening when you were clicking the menu item – it was trying to open a sub-menu instead of going to the link.

    If you change that option to “Hover”, it should work.

    #1211381
    johnaps

    That worked thank you Tom! 🙂
    Can you help me a bit with the css(I cant bring it up front off the main menu bar…)?

    Or can i open a new thread and maybe get some help with styling it like the image bellow? Which has a tricky part off implementing a button (to login) inside the menu, that is shown only to unlogged users?

    View post on imgur.com

    #1212203
    Tom
    Lead Developer
    Lead Developer

    Multi columns like that would be difficult, but the shadow/arrow part should be do-able if you want to open a new topic 🙂

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