A Diffrent Type of navigation (4 posts)

  1. HasanulBanna
    Posted 3 years ago #

    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>

    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'>";
    	echo "</ul>";
    	echo '</li>';
  2. radhika
    Posted 3 years ago #

    Follow this link wp_list_pages(), to create a different type navigation.

  3. HasanulBanna
    Posted 3 years ago #

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

  4. radhika
    Posted 3 years ago #

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

    $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;

Topic Closed

This topic has been closed to new replies.

About this Topic