cwulff

Untitled

Jan 21st, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1. <div class="boxed-in">
  2.         <?php get_template_part('templates/page', 'header'); ?>
  3.         <div class="row-fluid">
  4.                 <div class="span3 resourcemenu">
  5. <?php
  6.         $args = array(
  7.         'taxonomy' => 'seo_resource_topics',
  8.            'hierarchical' => true
  9.         );    
  10.         $terms = get_terms('seo_resource_topics', $args);
  11.         $count = count($terms);
  12.          if ( $count > 0 ){
  13.              echo "<ul>";
  14.              foreach ( $terms as $term ) {
  15.               $class= ($term->parent == 0) ? " parent-term" : "";
  16.               echo "<li><a class=\"scroll".$class."\" href=#" . $term->slug . ">" . $term->name . "</a></li>";
  17.              }
  18.              echo "</ul>";
  19.         }
  20. ?>
  21.                 </div>
  22.  
  23.                 <div class="span9">
  24.                         <div class="resourcearchive padded">
  25. <?php
  26.     $taxonomy = 'seo_resource_topics';
  27.  
  28.     $parent_terms = get_terms( $taxonomy, array( 'orderby' => 'slug', 'parent' => 0) );
  29.  
  30.     foreach( $parent_terms as $parent_term) {
  31.         echo sprintf( '<h3 class="parent-term" id="%s">%s</h3>', $parent_term->slug, $parent_term->name);
  32.  
  33.         $child_terms = get_terms( $taxonomy, array( 'orderby' => 'slug', 'parent' => $parent_term->term_id) );
  34.  
  35.         foreach( $child_terms as $child_term) {
  36.  
  37.             $resourcequery = new WP_Query( array(
  38.                 'post_type' => 'seo_resource',
  39.                 'taxonomy' => $taxonomy,
  40.                                 'term' => $child_term->slug,
  41.                 'posts_per_page' => -1
  42.             ));
  43.  
  44.             if( $resourcequery->have_posts() ) {
  45.                 echo sprintf( '<h3 id="%s">%s</h3>', $child_term->slug, $child_term->name);
  46.                 while( $resourcequery->have_posts() ) {
  47.                     $resourcequery->the_post();
  48. ?>
  49.                     <article <?php post_class(); ?>>
  50.                         <header>
  51.                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  52.                         </header>
  53.                         <div class="entry-summary">
  54.                             <?php the_excerpt(); ?>
  55.                         </div>
  56.                     </article>
  57. <?php
  58.               }
  59.            }
  60.         }
  61.    }
  62. ?>
  63.                         </div>
  64.                 </div>
  65.         </div>
  66. </div>
Advertisement
Add Comment
Please, Sign In to add comment