-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-product.php
182 lines (122 loc) · 6.74 KB
/
archive-product.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
/**
* The template for displaying archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each one. For example, tag.php (Tag archives),
* category.php (Category archives), author.php (Author archives), etc.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area archive-custom-post-type archive-product-post-type">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
<div class="row">
<div class="col-sm-3">
<div class="category-items">
<ul>
<?php
$terms = get_terms( array(
'taxonomy' => 'product-category',
'hide_empty' => false
) );
if ( !empty($terms) ) {
foreach ( $terms AS $term ) {
?>
<li><a href="<?php echo get_term_link( $term ); ?>"><?php echo $term->name; ?></a></li>
<?php
}
}
?>
</ul>
<div class="primary-box"> </div>
</div>
</div>
<div class="col-sm-9">
<?php
$products_description = get_theme_mod( 'mafiran_products_archive_description' , '' );
if( !empty( $products_description ) ){
?>
<div class="products-introduction">
<div class="title"> <h4><?php echo __( 'Products' , 'mafiran' ); ?></h4> </div>
<div class="desc"><?php echo apply_filters( 'mafiran_short_description' , $products_description );?></div>
<div class="spr-general"></div>
</div>
<?php
}
?>
<div class="row carchive-inner-content-container">
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
?>
<div class="col-sm-6 carchive-post-item">
<article id="post-<?php the_ID(); ?>" <?php post_class('post custom-post-item'); ?>>
<?php if ('' !== get_the_post_thumbnail() && !is_single()) : ?>
<div class="post-thumbnail">
<?php
$attachment_id = get_post_thumbnail_id();
$img = get_sed_attachment_image_html( $attachment_id , "" , "600X400" );
?>
<?php
if ( $img ) {
echo $img['thumbnail'];
}
?>
<div class="info">
<div class="info-inner">
<a href="<?php the_permalink(); ?>" class="info-icons"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
<?php endif; ?>
<header class="entry-header entry-header--archive">
<div class="entry-title"><?php the_title(); ?></div>
<div class="entry-content">
<?php
$post_content = get_the_excerpt();
$post_content = apply_filters( 'the_excerpt' , $post_content );
$excerpt_length = 90;
$post_content = strip_tags( $post_content );
if( strlen( $post_content ) > $excerpt_length ){
$post_content = mb_substr( $post_content, 0, $excerpt_length ) . "...";
}
echo $post_content;
//the_content();
?>
</div>
</header>
</article>
</div>
<?php
endwhile;
?>
</div>
<?php
the_posts_pagination( array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
) );
?>
</div>
</div>
<?php
else :
get_template_part( 'template-parts/post/content', 'none' );
endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();