Advertisement
Guest User

Untitled

a guest
Apr 16th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Appellation
  4. */
  5. ?>
  6. <?php
  7. $cat_args = array(
  8. 'type' => 'appellation',
  9. 'taxonomy' => 'designation',
  10. 'orderby' => 'slug',
  11. 'order' => 'ASC',
  12. 'hierarchical' => true
  13. );
  14.  
  15. $categories = get_categories( $cat_args );
  16. $catCounter = 7;
  17. foreach($categories as $category) {
  18. $catCounter++;
  19.  
  20. if ($catCounter == 1) {
  21. echo '</div><div class="row knowledge-base">';
  22. }
  23. elseif ($catCounter == 8) {
  24. $catCounter = 1;
  25. echo '<div class="row knowledge-base">';
  26. }
  27. elseif ($catCounter == 3) {
  28. $catCounter = 0;
  29. }
  30.  
  31. echo '<div class="span3">';
  32. echo '<h2><a href="' . get_category_link( $category->term_id ) . '" title="' . $category->name . '" ' . '>' . $category->name.'</a></h2>';
  33.  
  34. // Sub category
  35. $sub_category = get_category($category);
  36. $subcat_args = array(
  37. 'type' => 'appellation',
  38. 'taxonomy' => 'designation',
  39. 'orderby' => 'name',
  40. 'order' => 'ASC',
  41. 'child_of' => $sub_category->cat_ID,
  42. 'parent' => $sub_category->cat_ID
  43. );
  44. $sub_categories = get_categories($subcat_args);
  45.  
  46. foreach($sub_categories as $sub_category) {
  47. echo '<ul class="sub-categories">';
  48. echo '<li><i class="icon-folder-close"></i> <a href="' . get_category_link( $sub_category->term_id ) . '" title="' . $sub_category->name . '" ' . '>' . $sub_category->name.'</a></li>';
  49. echo '</ul>';
  50. }
  51.  
  52.  
  53. //List Posts
  54.  
  55. // Smart Lists
  56. $cat_post_num = gt_get_option('kb_aticles_per_cat');
  57.  
  58. $sub_category_num = count($sub_categories);
  59. if ($sub_category_num != 0) {
  60. $cat_post_num_smart = $cat_post_num - $sub_category_num;
  61. } else {
  62. $cat_post_num_smart = $cat_post_num;
  63. }
  64. $posts_order = '' ;// of_get_option('st_hp_cat_posts_order');
  65.  
  66.  
  67. global $post;
  68. // Listed by popular?
  69. $cat_post_args = array(
  70. 'post_type' => 'appellation',
  71. 'numberposts' => $cat_post_num_smart,
  72. 'orderby' => $posts_order,
  73. 'category' => $category->term_id
  74. );
  75.  
  76. $cat_posts = get_posts($cat_post_args);
  77. echo '<ul class="category-posts">';
  78. foreach($cat_posts as $post) : setup_postdata($post);
  79. if (get_post_format() == 'video') {
  80. $post_icon = 'icon-film';
  81. } elseif (get_post_format() == 'image') {
  82. $post_icon = 'icon-picture';
  83. } else {
  84. $post_icon = 'icon-file';
  85. }
  86. ?>
  87.  
  88. <li><i class="<?php echo $post_icon; ?>"></i> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  89.  
  90. <?php
  91. endforeach;
  92. echo '</ul>';
  93. echo '<span class="label label-color"><a href="' . get_category_link( $category->term_id ) . '" title="" ' . '>View all ' . $category->count .' articles <i class="icon-chevron-right"></i></a></span>';
  94. echo '</div>';
  95. }
  96. ?>
  97. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement