• Hi,
    Can anybody help me to write a funtion that display folloing output using to list pages.

    <ul class="nav-bar topnavbg">
            <li class="active"><a href="#">Nav Item 1</a></li>
             <li class="has-flyout">
    		    <a href="#">Nav Item 2</a>
    		    <a href="#" class="flyout-toggle"><span> </span></a>
                    <ul class="flyout">
                    <!-- The Menues should have sub-menu functionality and they will be listed according to the class below -->
                      <li><a href="#">Sub Nav 1</a></li>
                      <li><a href="#">Sub Nav 2</a></li>
                      <li><a href="#">Sub Nav 3</a></li>
                    </ul>
    </ul>

    I have tried different version but bot work.

    Please see an example

    function js_list_pages_include_tree(){
    
    $pages = get_pages('title_li=&depth=0');
    
    // Print the children
    foreach ($pages as $pagg)
    	{
    	echo '<li class="has-flyout"><a href="'.get_page_link($pagg->ID).'">'. $pagg->post_title.'</a>';
    	echo "<ul class='flyout'>";
    		   wp_list_pages('title_li=&child_of='.get_page_link($pagg->ID).'&depth=1');
    	echo "</ul>";
    	echo '</li>';
    	}
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Follow this link wp_list_pages(), to create a different type navigation.

    Thread Starter HasanulBanna

    (@hasanulbanna)

    Hi,
    But its not working,, Its seems like complex can you help me?

    you can be use this link wp_list_pages() code in header.php file of your theme for create the navigation. Such as:

    <?php
    $output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' );
    if (is_page( )) {
      $page = $post->ID;
      if ($post->post_parent) {
        $page = $post->post_parent;
      }
      $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );
      if ($children) {
        $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=<h2>Child Pages</h2>');
      }
    }
    echo $output;
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A Diffrent Type of navigation’ is closed to new replies.