WordPress: loop through each Taxonomy term

$terms = get_terms('custom-post-type-name');
   foreach ($terms as $term) {
      $wpq = array ('taxonomy'=>'custom-post-type-name','term'=>$term->slug);
      $myquery = new WP_Query ($wpq);
      $article_count = $myquery->post_count;
      echo "<h3 class=\"term-heading\" id=\"".$term->slug."\">";
      echo $term->name;
      echo "</h3>";
      if ($article_count) {
         echo "<ul>";
         while ($myquery->have_posts()) : $myquery->the_post();
            echo "<li><a href=\"".get_permalink()."\">".$post->post_title.      "</a></li>";
         endwhile;
         echo "</ul>";
      }
}

source

WordPress Menu: Fixed section menu for pages

With this PHP function you can create a hierarchical and navigational menu for your pages in WordPress. It will take the top parent page and keep it as a title, and then build their children pages keeping the hierarchy and the same markup used in wp_list_pages();
Continue Reading →