-
Notifications
You must be signed in to change notification settings - Fork 1
/
category.php
133 lines (102 loc) · 3.53 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
/**
* The template for displaying Blog category.
*
* @package Base-Theme
*/
get_header();
$base_theme_queried_object = get_queried_object();
$base_theme_queried_object_id = get_queried_object_id();
$base_theme_category_image = get_field( 'image_cat', $base_theme_queried_object );
?>
<div class="grid-container">
<div class="grid-x grid-margin-x">
<div class="cell small-12 medium-8 large-8">
<div id="primary">
<main id="main" class="site-main" role="main">
<div class="tagList">
<?php
$base_theme_tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'base-theme' ) );
if ( $base_theme_tags_list ) {
/* translators: 1: list of tags. */
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'base-theme' ) . '</span>', $base_theme_tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
<?php if ( have_posts() ) { ?>
<header class="page-header">
<div class="grid-x grid-margin-x">
<div class="cell small-12 medium-8">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</div>
<div class="cell small-12 medium-4">
<?php
if ( ! empty( $base_theme_category_image ) ) {
echo wp_get_attachment_image( $base_theme_category_image, 'full' );
} else {
base_theme_placeholder_image();
}
?>
</div>
</div>
</header><!-- .page-header -->
<hr />
<div class="subcategory_block">
<strong><?php esc_html_e( 'Sub Category: ', 'base-theme' ); ?></strong>
<?php
$base_theme_sub_categories = get_terms(
array(
'taxonomy' => Base_Theme\Inc\Taxonomies\Taxonomy_Sub_Category::SLUG,
)
);
if ( ! is_wp_error( $base_theme_sub_categories ) && ! empty( $base_theme_sub_categories ) ) {
foreach ( $base_theme_sub_categories as $base_theme_sub_category ) {
$base_theme_sub_category_link = get_term_link( $base_theme_sub_category );
if ( ! is_wp_error( $base_theme_sub_category_link ) && ! empty( $base_theme_sub_category_link ) ) {
add_filter( 'term_link', 'base_theme_term_link', 10, 3 );
printf(
'<a href="%1$s">%2$s</a> | ',
esc_url( $base_theme_sub_category_link ),
esc_html( $base_theme_sub_category->name )
);
remove_filter( 'term_link', 'base_theme_term_link' );
}
}
}
?>
</div>
<?php
$i = 1;
/* Start the Loop */
while ( have_posts() ) {
the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/category', 'content' );
if ( 0 === $i % 4 ) {
echo '<hr />';
base_theme_display_advert( 'advert-archive-listing' );
}
$i++;
}
?>
<?php } else { ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php } ?>
</main><!-- #main -->
<?php base_theme_pagination(); ?>
</div><!-- #primary -->
</div>
<div class="cell small-12 medium-4 large-4">
<?php get_sidebar(); ?>
</div>
</div>
</div>
<?php
get_footer();