-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.php
106 lines (94 loc) · 4.17 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package pozhelaju
*/
get_header();
$get_child_cat_params = array(
'child_of' => get_queried_object()->cat_ID,
'hide_empty' => false,
);
$terms = get_terms( 'category', $get_child_cat_params );
$status_list = get_term_meta( get_queried_object()->term_id, '__term_meta_text', true );
?>
<div id="bottom_panel"></div>
<div id="primary" class="content-area">
<main id="main" class="site-main container">
<div class="row">
<div class="col-lg-3 d-none d-lg-block"><?php get_template_part( 'template-parts/menu', 'global' ) ?></div>
<div class="col-lg-6 col-sm-12 col-xs-12 main-content">
<section class="">
<div class="wrapper-post single-list-category bootom-border shadow">
<?php if ( function_exists( 'bcn_display' ) ) {
bcn_display();
} ?>
</div>
</section>
<?php if ( ! empty( category_description() ) ): ?>
<section class="">
<div class="wrapper-post single-list-category bootom-border shadow">
<h2><?php echo get_queried_object()->name; ?></h2>
<?php echo category_description() ?>
</div>
</section>
<?php endif; ?>
<?php if ( sizeof( $terms ) > 0 and $status_list != 'on' ) : ?>
<section class="">
<div class="wrapper-post single-list-category bootom-border shadow">
<?php
foreach ( $terms as $term ) {
if ( $term->parent == get_queried_object()->cat_ID ) {
echo '<a href="' . esc_url( get_category_link( $term->term_id ) ) . '" class=" tag-list btn btn-outline-' . get_rand_color() . ' " alt="' . $term->name . '"><strong>' . $term->name . '</strong></a>';
}
}
?>
</div>
</section>
<?php elseif ( sizeof( $terms ) > 0 and $status_list == 'on' ) : ?>
<div class="row">
<div class="col-sm-12">
<div class="card text-white bg-dark">
<div class="card-header">Выберите подкатегорию</div>
<?php
foreach ( $terms as $term ) {
if ( $term->parent == get_queried_object()->cat_ID ) {
?>
<div class="card-body">
<p class="card-text">
<a href="<?php echo esc_url( get_category_link( $term->term_id ) ) ?>"
class="link"><?php echo $term->name; ?></a>
<br>
<?php echo category_description( $term->term_id ) ?>
</p>
<a href="<?php echo esc_url( get_category_link( $term->term_id ) ) ?>"
class=" text-white card-link btn btn-outline-<?php echo get_rand_color() ?>">Открыть
раздел</a>
</div>
<hr>
<?php
}
}
?>
</div>
</div>
</div>
<?php endif; ?>
<?php if ( $status_list != 'on' ) : ?>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'category' );
endwhile; // End of the loop.
?>
<?php pagination(); ?>
<?php endif; ?>
</div>
<div class="col-lg-3 d-none d-lg-block"><?php get_sidebar(); ?></div>
</div>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();