Custom Menu HTML with Walker ?
Hi. I am fairly new to wordpress, and am looking to move my website to the wordpress CMS. I want to retain my site’s current design, and I am having trouble getting the menu to style properly.
I have searched and researched to no avail about creating a custom menu walker to output the exact html I would like, instead of generating all the CSS class/ids that a regular menu creates.
I have never used or created a custom walker before, and cannot seem to find any good tutorials anywhere explaining how to create one or even what each line of the code does.
I would like the output html to be as follows:
<div id="links"> <ul class="links"> <li id="links1"><a href="index.html" class="current"></a></li> <li id="links2"><a href="about.html" class="base"></a></li> <li id="links3"><a href="contact.html" class="base"></a></li> <li id="links4"><a href="site_map.html" class="base"></a></li> </ul> </div>
I would also like the ‘a’ class to be “current” for each page that the user is currently on (i.e. when they visit the About page, then the “about/” link ‘a’ class should be “current” and all the rest should be “base”)
I hope I have explained myself well; please feel free to ask me any questions if I did not make sense.
Thanks for the help in advance.
This is done with CSS. The CSS, if even provided with theme for current item, may need to be updated to your desire, but is always best done in a Child Theme.
A site link can help forum users who choose to help with CSS issues (but CSS issues are not a direct WP Support item).
Without a way to review the CSS on your site in a browser or with a web inspection tool, we can be of little assistance in this matter.
- The topic ‘Custom Menu HTML with Walker ?’ is closed to new replies.