forked from erasta/kzradio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.php
75 lines (72 loc) · 2.48 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
<?php get_header(); ?>
<main class="container">
<div class="row">
<div id="content" role="main">
<main id="main" class="magazine">
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h1><?php
echo '<span>קטגוריה: </span>';
echo single_cat_title();
?></h1>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<?php
$category = get_queried_object();
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'desc',
'posts_per_page' => '27',
'cat' => $category->term_id,
'paged' => $paged
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
echo '<div class="magazine-items-wrapper">';
while ( $query->have_posts() ) {
$query->the_post(); ?>
<div class="magazine-item">
<div class="img-wrapper">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('magazine_lobby');?>
</a>
<?php $categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<div class="items-cat">';
echo '<a href="'.get_category_link($categories[0]->term_id).'" class="item-cat">'.esc_html( $categories[0]->name ).'</a>';
if($categories[1]->name != '') echo '<a href="'.get_category_link($categories[1]->term_id).'" class="item-cat">'.esc_html( $categories[1]->name ).'</a>';
echo '</div>';
}?>
</div>
<div class="item-content-wrapper">
<h3 class="item-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="item-excerpt">
<?php the_excerpt(); ?>
</div>
<div class="item-details">
<div class="item-author"><?php the_author(); ?></div>
<div class="item-date"><?php echo get_the_date(); ?></div>
</div>
</div>
</div>
<?php }
echo '</div>';
wp_reset_query();
}?>
</div>
</div>
</div>
</div>
<?php //get_sidebar(); ?>
</main>
</div>
</div><!-- /.row -->
</main><!-- /.container -->
<?php get_footer(); ?>