• Resolved bnock21

    (@bnock21)


    Is there a way to cause the parent links of the menu to drop down when hovered over and link to their pages when clicked? I understand why Customizr is set up this way (to be usable on smartphones and tablets) but for what I’m doing, I need it to work on hover.

Viewing 7 replies - 16 through 22 (of 22 total)
  • What do you want to do? Just dropdown on hover, or make the parents clickable? The first requires simple CSS that you can put in the Custom CSS panel. The second requires php (and will be useless on phones and tablets anyway.

    I talked about the 2nd one… where do I have to put the php code? (sorry but I’m a noob :/ )

    Read his post again.

    … so I edited header-nav_walker.php to …

    I just put the code in the correct .php file but now I have an error:
    Fatal error: Cannot redeclare TC_nav_walker::start_el() in /home/a2860904/public_html/wp-content/themes/customizr/parts/class-header-nav_walker.php on line 116

    What do I have to do?

    You need to copy class-header-nav_walker.php in your child theme (replicating the same folder structure! – if you copy it in your functions.php you’ll get the same error again!) and modify (practically replace) the function start_el() with the code above, not add it. The error you posted is php’s way of saying: “Can’t have same function declared more than once, mate. Give it another name or delete one version.”

    You already have the same function declared earlier, probably in the same file. Or in functions.php of your child theme, if that’s where you pasted the code.

    In order to shed a little light on WP’s logic regarding child themes: whenever it needs a file from the theme, WP first searches in the child theme. If the file’s not there, it gets fed from parent. So, whenever you want to modify anything from the parent, copy the file to the same folder in your child theme and hack it away. This rule doesn’t apply to functions.php and style.css though.

    Also, beware that when the parent gets updated, sometimes the files you copied to your child theme have been modified and you can’t benefit from the mods unless you copy again the original from the parent and make the mods once more (saving in your child theme).

    Thanks to acub for helping me ??
    I just replaced the function start_el code in the header-nav_walker.php with the code above and put it into my child theme in: themes/Customizrchild/parts
    …but it still doesn’t work.
    Has someone already tested the code if its work or does someone has an idea what I’m doing wrong :/
    If it helps: https://immanuelinternationalev.comlu.com/ is my site ??

    Took me all day, but I’ve come up with a solution for this.
    NOTE: this new solution is incompatible with the find&replace one posted above. Make sure you delete the replacement rule from RTFR plugin first.
    Also, you need to delete class-header-nav_walker.php from child theme and only leave the original in parent theme.

    My advice is to eliminate all other styling you’ve done for menu and reaply it (if necessary) after you activate the the filter function.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Menu dropdown on hover and all parents link’ is closed to new replies.