Name anchoring for WordPress Menus
-
I’ve been going at this for a while without much luck. Could anyone explain how I would rewrite this code so that the effect of scrolling down a single page is still the the same, but instead of automatically listing pages from the site I’d be able to generate custom menus from WordPress’s built in menu tool? Thanks.
<ul id="mainNav"> <li id="nav-home"><a href="#home">Home</a></li> <?php $pages = get_pages('sort_column=menu_order'); foreach ($pages as $page) { $link = '<li id="nav-'.$page->post_name.'"><a href="#'.$page->post_name.'">'.$page->post_title.'</a></li>'; echo $link; } ?> </ul>
- The topic ‘Name anchoring for WordPress Menus’ is closed to new replies.