samedi 28 février 2015

WordPress Custom Menu (3rd Level Nesting Issue)

I've ran into a problem using a custom WordPress menu that I can't seem to solve, so after doing a lot of searching the web & failing to fix this over the past few days, I've decided to see if anybody here on StackOverflow can help.


Please note: I would use a Walker function for this but I'm too far gone with the code right now and the way the design works I'm having to build the menu this way.


My snippet for my dropdown: http://ift.tt/1MRuwEL (would post but it would crucify the screen).


I’m having trouble with the 3rd level of my dropdown menu. In this image: http://ift.tt/1MRuwEP you can see that there’s a <li></li> that I’ve highlighted (Pages, About Me, About Us). The structure is as follows



Pages (Parent)
About Me (Parent: Pages)
About Us (Parent: About Me)


And these are fine, BUT when it goes to the third dropdown, it cuts of the <li> and leaves the rest of the Pages children and puts them into a separate container and not the <li> for Pages.


So it should work like so:



Pages (Parent)
About Me (Parent: Pages)
About Us (Parent: About Me)
Right Sidebar (Parent: Pages)
Left Sidebar (Parent: Pages)
Our Process (Parent: Pages)


And all though it may look like this on the dropdown (visually), as you can see in the code it isn’t represented by this. I think the problem I’m having is the checks I’m doing for closing the </li> is wrong. I’ve had this problem for a few days and I just can't seem to fix it. I was going to post this on the WordPress based forum but it's more of a PHP error than anything else.


Here’s a quick screenshot of me hovering over the elements that should be in Pages: http://ift.tt/17XLKj1 - as you see they’re separated from the <li>.


To replicate this what I've done is just created a menu structure in WordPress and used the code that's in the snippet (basically I just pasted it into the index.php file) to show how it's being represented.


I really hope somebody can help with this as it has been driving me mad and put a holt on my project for the past few days.


Apologies for the links above, I would post them directly in (screenshots & code) but I didn't want to take away from the actual problem.


If somebody does manage to provide me with the solution I'd be more than happy to buy you a virtual coffee or two!


Aucun commentaire:

Enregistrer un commentaire