-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop-zbirke.php
More file actions
137 lines (121 loc) · 3.84 KB
/
Copy pathloop-zbirke.php
File metadata and controls
137 lines (121 loc) · 3.84 KB
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
<pre class="font-size-2 red">
<?php
echo "post_type_archive " . is_post_type_archive() . "\n";
echo "page " . is_page('knjige') . "\n";
echo "category " . is_category() . "\n";
echo "tax " . is_tax('zbirka') . "\n";
echo "archive " . is_archive() . "\n";
?>
</pre>
<?php
global $post;
global $wp_query;
//global $wpdb;
global $request;
$myIterator = 0;
global $myNumberOfPosts;
$myNumberOfPosts = 9;
$series = 'prisleki';
$queryTax = $wp_query->query_vars['taxonomy'];
$queryTerm = $wp_query->query_vars['term'];
if ($queryTax == "zbirka" and isset($queryTerm)) {
$series = $queryTerm;
}
$args = array_merge(
//$wp_query->query,
array(
'posts_per_page' => $myNumberOfPosts,
'posts_per_archive_page' => $myNumberOfPosts,
'paged' => get_query_var('paged'),
'post_status' => 'publish',
'post_type' => 'knjiga',
'meta_key' => 'izid',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'zbirka',
'field' => 'slug',
'terms' => $series
)
)
)
);
//$myBookTitles = get_posts($args);
//echo "<!-- WP_QUERY1:::"; print_r($wp_query); echo " -->";
$myBookTitles = new WP_Query($args);
//echo "<!-- WP_QUERY2:::"; print_r($myBookTitles); echo " -->";
//echo "
/*
// <!-- WP_QUERY ::: " . $wp_query->request . " -->";
echo "
<!-- WP_QUERY2 ::: " . $myBookTitles->request . " -->";
//echo "
// <!-- WP_QUERY3 :::"; print_r($wp_query->query); echo " -->";
echo "
<!-- WP_QUERY4 :::"; print_r($myBookTitles->query); echo " -->";
*/
//if (have_posts()) :
?>
<div class="myMainPosts float clearfix nineCol">
<ul class="clearfix">
<?php //foreach($myBookTitles as $post) : setup_postdata($post); $myIterator++ ?>
<?php while ($myBookTitles->have_posts()) : $myBookTitles->the_post(); $myIterator++; ?>
<?php
$this_post_master_id = $post->ID;
$term_list = wp_get_post_terms($post->ID, 'ime_avtorja', array("fields" => "names"));
$useName = implode(", ", $term_list);
?>
<?php if (($myIterator != 0) and !($myIterator % 3)) { ?>
<?php $myPostMargin = ""; ?>
<?php } else { ?>
<?php $myPostMargin = " hasRightMargin"; ?>
<?php } ?>
<li class="myPostItem threeCol float <?php echo $myPostMargin; ?>">
<div class="postExcerpt">
<?php if (has_post_thumbnail()) : ?>
<a class="bare" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('myBookThumbnail', array('class' => $myAddClass, 'alt' => trim(strip_tags(get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true))))); ?>
</a>
<?php endif; ?>
</div>
<div class="paddedText">
<h5 class="uppercase"><?php echo $useName; ?></h5>
<h4><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
<p class="myBookQuote"><?php echo get_post_meta($post->ID, 'citat', true);?></p>
<p class="zbirka"><?php echo get_post_meta($post->ID, 'zbirka', true); ?></p>
<p class="izid">(leto izida: <?php echo get_post_meta($post->ID, 'izid', true); ?>)</p>
<?php newlitDisplayPrizeMeta($this_post_master_id, 0); ?>
</div>
</li>
<?php if (($myIterator != 0) and !($myIterator % 3)) { ?>
<li style="clear: both; height: 0px"></li>
<?php } ?>
<?php
endwhile;
//endforeach;
?>
</ul>
<?php
//$max_num_pages = $myBookTitles->max_num_pages;
//$paged = get_query_var('paged');
//$my_max_num_pages = ceil($wp_query->found_posts / $myNumberOfPosts);
//echo "<!-- my max num pages: $my_max_num_pages ::: $wp_query->found_posts -->";
?>
<div class="clearfix floatRight" id="myPagination">
<?php
//$big = 999999999; // need an unlikely integer
echo paginate_links(
array(
'prev_text' => '« Novejše',
'next_text' => 'Starejše »',
//'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'base' => get_pagenum_link() . '%_%',
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $myBookTitles->max_num_pages
)
);
?>
</div>
</div>