• Hi,

    I have a mega drop down menu being used my primary navigation. When a page is defined as a child of another page (within the edit page screen) it is automatically added to the mega drop down menu. It displays the list of page using this code (defined in the functions.php file):

    // navigation
       function print_subnav($parent_id) {
        $pages = get_pages('child_of=' . $parent_id);
    	$pages = apply_filters( 'get_pages', $pages );
    
    	if(!empty($pages)) {
        	echo '<div class="sub">';
    	foreach($pages as $page) {
    	    if($page->post_parent==$parent_id) {
    
    		echo '<ul>';
    		$before = '<h2>';
    		$after = '</h2>';
    		echo '<li>' . $before . '<a href="' . get_page_link($page->ID) . '">' . $page->post_title . '</a>' . $after .'</li>';
    
    		$grandchildren = get_pages('child_of=' . $page->ID);
    		foreach($grandchildren as $grandchild) {
    		    echo '<li><a href="' . get_page_link($page->ID) . $grandchild->post_name . '">' . $grandchild->post_title . '</a></li>';
    
    		}
    
    		echo '</ul>';
    	    }
    	}
    	echo '</div>';
        }
    }
       // navigation-end

    Which part of this dictates the order in which pages display? I need to enable administrators the ability to change the order in which child pages display when the mouse hovers over the parent link.

    Any pointers? I’m not really a developer so not that up on it.

    Thanks in advance

The topic ‘Navigation order’ is closed to new replies.