WordPress.org

Ready to get started?Download WordPress

Forums

Name anchoring for WordPress Menus (1 post)

  1. Buca
    Member
    Posted 1 year ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic