This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
forked from korbinian/Piratenkleider
-
Notifications
You must be signed in to change notification settings - Fork 24
/
category-index.php
138 lines (110 loc) · 4.22 KB
/
category-index.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
<?php
/*
Template Name: Category Index
*/
?><?php get_header();
global $options;
if ( $options['slider-aktiv'] == "1" ){ ?>
<div class="section teaser">
<div class="row">
<?php get_sidebar( 'teaser' ); ?>
</div>
</div>
<?php } ?>
<div class="section content" id="main-content">
<div class="row">
<div class="content-primary">
<div class="skin">
<?php
if ( have_posts() ) while ( have_posts() ) : the_post();
$content = trim(get_the_content());
if (strlen($content)>0) {
echo $content;
edit_post_link( __( 'Edit', 'piratenkleider' ), '', '' );
echo '<hr class="clear">';
}
endwhile;
$foundarticles=0;
$i = 0;
global $wp_query;
$cat_array = array();
$categories=get_categories(array('orderby' => 'name','order' => 'ASC'));
foreach($categories as $category) {
if (!is_wp_error( $category )) {
$cat_array[$category->term_id] = $category->term_id;
}
}
$num = $options['categoryindex-numlinklist'] + 1;
wp_reset_query();
$subcatquery = array();
if ($cat_array) {
foreach($cat_array as $cat) {
$category = get_term_by('id',$cat, 'category');
$title = '<h2>' . $category->name.'</h2>';
$subcatquery =array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $num,
'cat' => $cat,
'ignore_sticky_posts'=> 1
);
$i=0;
$my_query = null;
$my_query = new WP_Query($subcatquery);
$liste = '';
$topentry = '';
$catfound = 0;
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
$foundarticles =1;
$catfound = 1;
if ($i==0) {
$topentry = piratenkleider_category_teaser($my_query);
$i=1;
} else {
$liste .= '<li><a href="'.get_permalink().'" rel="bookmark">';
$liste .= get_the_title();
$liste .= "</a></li>\n";
}
endwhile;
if ($catfound==1) {
echo '<div class="categorybox cat-'.$cat.'">';
echo $title;
echo $topentry;
if (strlen($liste)>0) {
echo '<h3 class="skip">Weitere Artikel aus dem Bereich '.$category->name.'</h3>';
echo "\n";
echo '<ul class="catliste">';
echo $liste;
echo "</ul>\n";
echo '<p><a href="' . esc_attr(get_term_link($category, 'category'))
. '" title="' . sprintf( __( "Entries of category %s" , 'piratenkleider'), $category->name )
. '" ' . '>'.__('More entries...','piratenkleider').'</a>'.'</p>';
}
echo "</div>\n";
}
}
wp_reset_query();
}
}
if ($foundarticles==0) { ?>
<h2><?php _e("Nothing found", 'piratenkleider'); ?></h2>
<p>
<?php _e("No matching pages or entries found. Please try to search with another term.", 'piratenkleider'); ?>
</p>
<?php get_search_form();
echo "<hr>\n";
}
?>
</div>
</div>
<div class="content-aside">
<div class="skin">
<h1 class="skip"><?php _e( 'More information', 'piratenkleider' ); ?></h1>
<?php get_sidebar(); ?>
</div>
</div>
</div>
<?php get_piratenkleider_socialmediaicons(2); ?>
</div>
<?php get_footer(); ?>