-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.php
34 lines (30 loc) · 1.15 KB
/
category.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* The template for displaying Archive pages.
*
* Learn more: https://codex.wordpress.org/Template_Hierarchy
*
* @package iPanelThemes Knowledgebase
*/
get_header();
$cat_id = get_query_var( 'cat' );
$cat = get_category( $cat_id );
$term_meta = get_option( 'ipt_kb_category_meta_' . $cat_id, array() );
$sub_categories = get_categories( array(
'taxonomy' => 'category',
'parent' => $cat->term_id,
'hide_empty' => 0,
'number' => '',
) );
?>
<section id="primary" class="content-area<?php if ( $cat->parent != '0' || empty( $sub_categories ) ) echo ' col-md-8'; ?>">
<main id="main" class="site-main <?php echo ( $cat->parent == '0' ? 'ipt-kb-parent' : 'ipt-kb-child' ); ?>" role="main">
<?php if ( $cat->parent == '0' && ! empty( $sub_categories ) ) : ?>
<?php get_template_part( 'category-templates/category', 'parent' ); // This is a parent category ?>
<?php else : ?>
<?php get_template_part( 'category-templates/category', 'child' ); // This is a parent category ?>
<?php endif; ?>
</main><!-- #main -->
</section><!-- #primary -->
<?php if ( $cat->parent != '0' || empty( $sub_categories ) ) get_sidebar(); ?>
<?php get_footer(); ?>