cwulff

Resource Archive Problem

Jan 21st, 2014
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <div class="boxed-in">
  2.  
  3. <?php get_template_part('templates/page', 'header'); ?>
  4.  
  5. <div class="row-fluid">
  6. <div class="span3 resourcemenu">
  7.  
  8.  
  9. <?php
  10.  
  11.     $args = array(
  12.  
  13.         'taxonomy' => 'seo_resource_topics',
  14.  
  15.     'hierarchical' => true
  16.  
  17.     ); 
  18.  
  19.     $terms = get_terms('seo_resource_topics', $args);
  20.  
  21.     $count = count($terms);
  22.  
  23.      if ( $count > 0 ){
  24.  
  25.          echo "<ul>";
  26.  
  27.          foreach ( $terms as $term ) {
  28.  
  29.           $class= ($term->parent == 0) ? " parent-term" : "";
  30.  
  31.               echo "<li><a class=\"scroll".$class."\" href=#" . $term->slug . ">" . $term->name . "</a></li>";
  32.  
  33.  
  34.  
  35.          }
  36.  
  37.          echo "</ul>";
  38.  
  39.     }
  40.  
  41. ?>
  42.  
  43. </div>
  44.  
  45. <div class="span9">
  46.  
  47. <div class="resourcearchive padded">
  48.  
  49. <?php
  50.  
  51. $taxonomy = 'seo_resource_topics';
  52.  
  53.   // Gets every "category" (term) in this taxonomy to get the respective posts
  54.  
  55.   $terms = get_terms( $taxonomy );
  56.  
  57.   foreach( $terms as $term ) :
  58.  
  59.      $class= ($term->parent == 0) ? " class=\"parent-term\"" : "";
  60.  
  61.       echo '<h3 '.$class.'id="' . $term->slug . '">'. $term->name. '</h3>';
  62.  
  63.             if ( $term->parent == 0 ) continue;
  64.  
  65.       $resourcequery = new WP_Query(array(
  66.  
  67.         'post_type' => 'seo_resource',
  68.  
  69.         'taxonomy' => $taxonomy,
  70.  
  71.         'term' => $term->slug,
  72.  
  73.         'posts_per_page' => -1
  74.  
  75.         ));
  76.  
  77.       if( $resourcequery->have_posts() ): while( $resourcequery->have_posts() ) : $resourcequery->the_post(); ?>
  78.  
  79.      
  80.  
  81.           <article <?php post_class(); ?>>
  82.  
  83.               <header>
  84.  
  85.                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  86.  
  87.               </header>
  88.  
  89.               <div class="entry-summary">
  90.  
  91.                 <?php the_excerpt(); ?>
  92.  
  93.               </div>
  94.  
  95.             </article>
  96.  
  97.       <?php endwhile; ?>
  98.  
  99.       <?php endif;
  100.  
  101.   endforeach;
  102.  
  103. ?>
  104.  
  105. </div>
  106.  
  107. </div>
  108.  
  109. </div>
  110.  
  111. </div>
Advertisement
Add Comment
Please, Sign In to add comment