-
Notifications
You must be signed in to change notification settings - Fork 0
/
category-ospoljene-reci.php
185 lines (163 loc) · 5.13 KB
/
category-ospoljene-reci.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
183
184
185
<?php
/*
Template Name: Stran za kategorije
*/
?>
<?php get_header('home'); ?>
<style type="text/css">
.one-author {
position: relative;
flex-wrap: nowrap;
}
.one-author span {
white-space: nowrap;
}
.authors {
flex-wrap: wrap;
}
@media only screen and (max-width: 600px) {
.authors.flex {
display: flex;
}
li.gendered-item-block > div {
flex-direction: column;
flex-shrink: 0;
}
.gendered-item-block {
width: 100% !important;
}
.gendered-item-block .author-block .this-author-photo {
margin-left: auto; margin-right: auto;
width: 25% !important;
}
.gendered-item-block .triangle-inner {
width: 100% !important;
}
.myPostListItem:nth-of-type(even) .author-block {
order: 0;
}
.description-block {
width: 100% !important;
box-sizing: border-box;
}
html body h1 {
text-align: center;
width: 100% !important;
}
}
</style>
<!-- category.php -->
<!-- LOOP -->
<?php
global $post, $wpdb, $my_query, $paged, $wp_query, $request; // brez tega ne dela get_post_meta
global $myNumberOfPosts;
$myNumberOfPosts = 20;
/*
$args = array(
'posts_per_page' => $myNumberOfPosts,
'posts_per_archive_page' => $myNumberOfPosts,
'paged' => get_query_var('paged'),
'cat' => get_query_var('cat'),
'post_type' => $wp_query->query_vars['post_type']
);
*/
$args = //array_merge(
//$wp_query->query,
array(
'posts_per_page' => $myNumberOfPosts,
'posts_per_archive_page' => $myNumberOfPosts, //bistveno!
'paged' => get_query_var('paged'),
//'category__not_in' => array(3902, 3846, 3848), //dodal izpostavljeno – ker je kao samo ena, in to na coverju
'post_status' => array('publish', 'draft'),
'meta_query' => array(
'relation' => 'AND',
'meta_title' => array(
'key' => 'gendered-topic-name'
),
'meta_order' => array(
'key' => 'gendered-topic-order'
)
),
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'ime_avtorja',
'field' => 'slug',
'operator' => 'EXISTS'
),
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'ospoljene-reci'
),
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => array(3902, 3846, 3848),
'operator' => 'NOT IN'
)
),
'orderby' => array('meta_order' => 'ASC', 'date' => 'ASC')
)
//)
;
$myCurrentLoop = new WP_Query($args);
$myCoverStoriesNum = 999; // to pomeni, da bdo praktično vsi prispevki, kadar jih prikazujemo na arhivski strani, eden pod drugim, tj. nikoli ne bodo po denimo štirje na vrstico (kot bi bili na prvi strani)
//$myCurrentLoop = new WP_Query($args);
require('local-array-column.php');
$authorThumbnailURL = array();
if ($myCurrentLoop->have_posts()) :
$i = 0;
foreach($myCurrentLoop->posts as $myPost) :
$names = get_the_terms($myPost, 'ime_avtorja');
if (!in_array($names[0]->name, array_column($authorThumbnailURL, 'name'))) :
$authorPage = get_page_by_title($names[0]->name, OBJECT, 'Avtor');
if (!empty($authorPage)) {
if (has_post_thumbnail($authorPage->ID)) {
$url = wp_get_attachment_image_src(get_post_thumbnail_id($authorPage->ID), 'myAuthorThumbnail');
$authorThumbnailURL[$i]['url'] = $url[0];
$authorThumbnailURL[$i]['name'] = $names[0]->name;
}
}
endif;
$i++;
endforeach;
$catDesc = category_description(get_query_var('cat'));
?>
<!--
<div class="mobile-override top-stripe-category light-blue-background fullw">
<div class="text-outer minimal-padding">
<p class="one-two font-size-2 bold">Arhiv prispevkov v rubriki <?php echo get_cat_name(get_query_var('cat')); ?> (<?php echo $myCurrentLoop->found_posts; ?>)</p>
</div>
</div>
-->
<h1 class=" small-top-padding stretch-full-width gray-background small-bottom-padding two-three leading-tight bold display-font font-size-7">Ospoljene reči</h1>
<?php if(!empty($catDesc)) { ?>
<div class='stretch-full-width gray-background-not gray-4-not no-indent-not large-top-padding large-bottom-padding' style="/*max-width: 33em; margin-left: auto; margin-right: auto;*/">
<div class="two-three-not font-size-1 leading-loose medium-top-padding medium-bottom-padding medium-left-padding medium-right-padding white-background center-margins gray-5">
<div style="column-width: 25em;">
<?php echo $catDesc; ?>
<p class="align-right small-top-margin"><em>Renata Šribar</em></p>
</div>
<div class="authors large-top-margin flex" style="">
<?php foreach ($authorThumbnailURL as $thumb) : ?>
<div class="one-author small-right-margin small-bottom-margin" style="border-radius: 25px 0 0 25px; background-color: #eee;">
<div style="width: 50px; display: inline-block; vertical-align: middle">
<div class="circle">
<div class="cover ratio-1-1" style="background-image: url(<?php echo $thumb['url'];?>)">
</div>
</div>
</div>
<span style="padding: 0 1em;"><?php echo $thumb['name']; ?></span>
</div>
<?php endforeach; ?>
</div>
<!--<div class="large-top-margin this-author-photo one-five center circle center-margins" style="margin-bottom: 2em">
<div class="cover ratio-1-1" style="background-image: url(http://www.ludliteratura.si/wp-content/uploads/2014/08/Mojca-Pisek-140x140.jpg)"></div>
</div>-->
</div>
</div>
<?php } ?>
<?php endif; ?>
<?php require('loop-gendered.php'); ?>
<?php get_footer(); ?>