-
Notifications
You must be signed in to change notification settings - Fork 1
/
archive.php
174 lines (127 loc) · 5.13 KB
/
archive.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
<?php
/*************************
HEADER + VARIABLES
*************************/
get_header();
$ifdone = $_COOKIE['muestradone'];
$cerrados = get_option('bach_closed');
$cerrado = get_cat_id($cerrados);
$esperas = get_option('bach_wait');
$espera = get_cat_id($esperas);
$usuarios = get_option('bach_users');
$users = get_cat_id($usuarios);
?>
<script language="JavaScript">
/* This function sets the cookie to show closed tasks */
function done(){
document.cookie = 'muestradone=si;'
}
function nodone(){
document.cookie = 'muestradone=no;'
}
/* end of cookie function */
</script>
<?php
/*************************
ARCHIVE FUNCTIONS
*************************/
?>
<div id="main">
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle"><?php __('Archive for ','bach'); ?> <?php single_cat_title(); ?></h2>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class="pagetitle"><?php single_tag_title(); ?></h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle"><?php __('Archive for ','bach'); ?> <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle"><?php __('Archive for ','bach'); ?> <?php the_time('F Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle"><?php __('Archive for ','bach'); ?> <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle"><?php the_author(); ?></h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle"><?php __('Blog archive','bach'); ?></h2>
<?php }
/*************************
PAGE CODE
*************************/
// Small script to control the show of closed tasks
?>
<div style="float:right;margin-top: -20px;padding-right:60px;"><h2><a class="rss" href="." onclick="done()"><?php _e('show pending','bach');?></a> <a class="rss" href="." onclick="nodone()"><?php _e('show all','bach');?></a></h2>
<br> <?php if ($ifdone == 'si') { _e('Showing pending','bach');} else {_e('Showing all','bach');} ?>
</div>
<br /><br /><br />
<?php // Pagination plugin (always shown)?>
<div class="navigation">
<?php
if(function_exists('pagination'))
pagination(2,array("← más recientes"," más antiguas →"));
?>
</div>
<?php
// WordPress Loop
while (have_posts()) : the_post(); ?>
<?php
if (($ifdone == 'si') && (in_category( $cerrado ))) {
?> <?php
} else { ?>
<?php
// foreach user category, if the post is in this category, get user id
$class_users = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = $users ORDER BY term_id DESC");
foreach ($class_users as $class_user){
if (in_category($class_user)){
$class_color = $class_user;
}}
?>
<div class="recuadro <?php echo 'color-'.$class_color; ?><?php if ( in_category( $espera ) ) { echo ' espera'; } ?>" id="post-<?php the_ID(); ?>">
<?php // Show the new category images
foreach((get_the_category()) as $category) {
$proyectos = get_option('bach_projects');
$proyecto = get_cat_id($proyectos);
if ( get_root_category($category) == $proyecto ) {
echo '<a href="'.get_bloginfo('url').'/?cat='.$category->cat_ID.'"><img src="'.trim(ereg_replace("</p>", "", category_description($category->cat_ID)),"<p>").'" alt="' . $category->cat_name . '" class="logo" height="48px" width="48px" style="float:right;" /><a>';
} }
?>
<h3 class="titulillo"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div align="center"><?php include (TEMPLATEPATH . '/clases.php'); ?></div>
<div class="post-datos">
<?php _e('Submitted by','bach');?> <a href="<?php bloginfo('url'); ?>/category/usuarios/<?php the_author(); ?>/"><?php the_author() ?></a>
<div class="post-tags">
<?php _e('Properties','bach');?>:
<?php the_category(' • ','') ?>
</div>
</div>
<div class="post-contenido">
<?php the_content('Read the rest of the post »'); ?>
</div>
</div>
<?php
$comments = get_comments('order=ASC&post_id='.$post->ID);
if ($comments) : ?>
<ul style="list-style-type:none;">
<?php foreach($comments as $comm) : ?>
<li id="prologue-<?php the_ID(); ?>" class="comment-<?php echo strtolower($comm->user_id); ?>">
<?php echo nl2br($comm->comment_content); ?>
</li>
<? endforeach; ?>
</ul>
<? endif; ?>
<br /><br />
<?php } ?>
<?php endwhile; ?>
<div class="navigation">
<?php
if(function_exists('pagination'))
pagination(2,array("← más recientes"," más antiguas →"));
?>
</div>
<?php else : ?>
<h2 class="center"><?php _e('Not found','bach');?></h2>
<p class="center"><?php _e('Sorry, the page you are looking for is not here','bach');?>.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>