Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Appellation
- */
- ?>
- <?php
- $cat_args = array(
- 'type' => 'appellation',
- 'taxonomy' => 'designation',
- 'orderby' => 'slug',
- 'order' => 'ASC',
- 'hierarchical' => true
- );
- $categories = get_categories( $cat_args );
- $catCounter = 7;
- foreach($categories as $category) {
- $catCounter++;
- if ($catCounter == 1) {
- echo '</div><div class="row knowledge-base">';
- }
- elseif ($catCounter == 8) {
- $catCounter = 1;
- echo '<div class="row knowledge-base">';
- }
- elseif ($catCounter == 3) {
- $catCounter = 0;
- }
- echo '<div class="span3">';
- echo '<h2><a href="' . get_category_link( $category->term_id ) . '" title="' . $category->name . '" ' . '>' . $category->name.'</a></h2>';
- // Sub category
- $sub_category = get_category($category);
- $subcat_args = array(
- 'type' => 'appellation',
- 'taxonomy' => 'designation',
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'child_of' => $sub_category->cat_ID,
- 'parent' => $sub_category->cat_ID
- );
- $sub_categories = get_categories($subcat_args);
- foreach($sub_categories as $sub_category) {
- echo '<ul class="sub-categories">';
- 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>';
- echo '</ul>';
- }
- //List Posts
- // Smart Lists
- $cat_post_num = gt_get_option('kb_aticles_per_cat');
- $sub_category_num = count($sub_categories);
- if ($sub_category_num != 0) {
- $cat_post_num_smart = $cat_post_num - $sub_category_num;
- } else {
- $cat_post_num_smart = $cat_post_num;
- }
- $posts_order = '' ;// of_get_option('st_hp_cat_posts_order');
- global $post;
- // Listed by popular?
- $cat_post_args = array(
- 'post_type' => 'appellation',
- 'numberposts' => $cat_post_num_smart,
- 'orderby' => $posts_order,
- 'category' => $category->term_id
- );
- $cat_posts = get_posts($cat_post_args);
- echo '<ul class="category-posts">';
- foreach($cat_posts as $post) : setup_postdata($post);
- if (get_post_format() == 'video') {
- $post_icon = 'icon-film';
- } elseif (get_post_format() == 'image') {
- $post_icon = 'icon-picture';
- } else {
- $post_icon = 'icon-file';
- }
- ?>
- <li><i class="<?php echo $post_icon; ?>"></i> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
- <?php
- endforeach;
- echo '</ul>';
- 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>';
- echo '</div>';
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement