My new digital agency EPIC is where you will find me, please visit us and see how we can help with your digital needs

WordPress menu / page plugin

9 years ago No comments

Hello everyone,

I am not one to fill my wordpress folder with plug-ins, I much prefer to set up a standard list of codes in my functions.php file.

Today I spent about 2 hours looking for some code for functions.php that would remove the link from a parent menu dropdown. I needed this cause when setting up pages and assigning them to a parent there is no functionality to tell the parent folder when there is no content, to not display the menu item as a link. I think WordPress should have this as an included function, maybe they will at a later stage.

So I spent ages looking for this code and came across http://bavotasan.com/tutorials/how-to-remove-the-links-to-parent-pages-in-the-wordpress-page-list/ however this code when applied to your functions.php does just the job except it removes the whole link, leave just the word. This caused issues with my menu as the dropdown I was using relied on the menu item having a link to work. I tried editing the code but without luck I couldn’t get it to replace the link with a #.

So I decided to resort to a plug-in and found this incredible one called Page Lists Plus it allows you to select any page and give it a link or not give it a link. Also has the option to make the link blank keeping the <a href> styling in the menu I was using.

I would recommend this plug-in for anyone who uses a drop down that relies on the <a> tag being in the dropdown menu list.

Comments are closed.