1
|
1 |
<?php |
|
2 |
|
|
3 |
// Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php, |
|
4 |
// links.php, page.php, search.php, single.php, tag.php |
|
5 |
// Just between #main and #container |
|
6 |
function thematic_abovecontainer() { |
|
7 |
do_action('thematic_abovecontainer'); |
|
8 |
} // end thematic_abovecontainer |
|
9 |
|
|
10 |
// Located in archives.php |
|
11 |
// Just after the content |
|
12 |
function thematic_archives() { |
|
13 |
do_action('thematic_archives'); |
|
14 |
} // end thematic_archives |
|
15 |
|
|
16 |
|
|
17 |
// Located in archive.php, author.php, category.php, index.php, search.php, single.php, tag.php |
|
18 |
// Just before the content |
|
19 |
function thematic_navigation_above() { |
|
20 |
do_action('thematic_navigation_above'); |
|
21 |
} // end thematic_navigation_above |
|
22 |
|
|
23 |
// Located in archive.php, author.php, category.php, index.php, search.php, single.php, tag.php |
|
24 |
// Just after the content |
|
25 |
function thematic_navigation_below() { |
|
26 |
do_action('thematic_navigation_below'); |
|
27 |
} // end thematic_navigation_below |
|
28 |
|
|
29 |
// Located in index.php |
|
30 |
// Just before the loop |
|
31 |
function thematic_above_indexloop() { |
|
32 |
do_action('thematic_above_indexloop'); |
|
33 |
} // end thematic_above_indexloop |
|
34 |
|
|
35 |
// Located in archive.php |
|
36 |
// The Loop |
|
37 |
function thematic_archiveloop() { |
|
38 |
do_action('thematic_archiveloop'); |
|
39 |
} // end thematic_archiveloop |
|
40 |
|
|
41 |
// Located in author.php |
|
42 |
// The Loop |
|
43 |
function thematic_authorloop() { |
|
44 |
do_action('thematic_authorloop'); |
|
45 |
} // end thematic_authorloop |
|
46 |
|
|
47 |
// Located in category.php |
|
48 |
// The Loop |
|
49 |
function thematic_categoryloop() { |
|
50 |
do_action('thematic_categoryloop'); |
|
51 |
} // end thematic_categoryloop |
|
52 |
|
|
53 |
// Located in index.php |
|
54 |
// The Loop |
|
55 |
function thematic_indexloop() { |
|
56 |
do_action('thematic_indexloop'); |
|
57 |
} // end thematic_indexloop |
|
58 |
|
|
59 |
// Located in search.php |
|
60 |
// The Loop |
|
61 |
function thematic_searchloop() { |
|
62 |
do_action('thematic_searchloop'); |
|
63 |
} // end thematic_searchloop |
|
64 |
|
|
65 |
// Located in single.php |
|
66 |
// The Post |
|
67 |
function thematic_singlepost() { |
|
68 |
do_action('thematic_singlepost'); |
|
69 |
} //end thematic_singlepost |
|
70 |
|
|
71 |
// Located in tag.php |
|
72 |
// The Loop |
|
73 |
function thematic_tagloop() { |
|
74 |
do_action('thematic_tagloop'); |
|
75 |
} // end thematic_tagloop |
|
76 |
|
|
77 |
// Located in index.php |
|
78 |
// Just after the loop |
|
79 |
function thematic_below_indexloop() { |
|
80 |
do_action('thematic_below_indexloop'); |
|
81 |
} // end thematic_below_indexloop |
|
82 |
|
|
83 |
|
|
84 |
// Located in category.php |
|
85 |
// Just before the loop |
|
86 |
function thematic_above_categoryloop() { |
|
87 |
do_action('thematic_above_categoryloop'); |
|
88 |
} // end thematic_above_categoryloop |
|
89 |
|
|
90 |
|
|
91 |
// Located in category.php |
|
92 |
// Just after the loop |
|
93 |
function thematic_below_categoryloop() { |
|
94 |
do_action('thematic_below_categoryloop'); |
|
95 |
} // end thematic_below_categoryloop |
|
96 |
|
|
97 |
|
|
98 |
// Located in search.php |
|
99 |
// Just before the loop |
|
100 |
function thematic_above_searchloop() { |
|
101 |
do_action('thematic_above_searchloop'); |
|
102 |
} // end thematic_above_searchloop |
|
103 |
|
|
104 |
|
|
105 |
// Located in search.php |
|
106 |
// Just after the loop |
|
107 |
function thematic_below_searchloop() { |
|
108 |
do_action('thematic_below_searchloop'); |
|
109 |
} // end thematic_below_searchloop |
|
110 |
|
|
111 |
|
|
112 |
// Located in tag.php |
|
113 |
// Just before the loop |
|
114 |
function thematic_above_tagloop() { |
|
115 |
do_action('thematic_above_tagloop'); |
|
116 |
} // end thematic_above_tagloop |
|
117 |
|
|
118 |
|
|
119 |
// Located in tag.php |
|
120 |
// Just after the loop |
|
121 |
function thematic_below_tagloop() { |
|
122 |
do_action('thematic_below_tagloop'); |
|
123 |
} // end thematic_below_tagloop |
|
124 |
|
|
125 |
// Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php, |
|
126 |
// links.php, page.php, search.php, single.php, tag.php |
|
127 |
// Just below #container |
|
128 |
function thematic_belowcontainer() { |
|
129 |
do_action('thematic_belowcontainer'); |
|
130 |
} // end thematic_belowcontainer |
|
131 |
|
|
132 |
|
|
133 |
// Filter the page title |
|
134 |
// located in archive.php, attachement.php, author.php, category.php, search.php, tag.php |
|
135 |
function thematic_page_title() { |
|
136 |
global $post; |
|
137 |
$content = ''; |
|
138 |
if (is_attachment()) { |
|
139 |
$content .= '<h2 class="page-title"><a href="'; |
|
140 |
$content .= get_permalink($post->post_parent); |
|
141 |
$content .= '" rev="attachment"><span class="meta-nav">« </span>'; |
|
142 |
$content .= get_the_title($post->post_parent); |
|
143 |
$content .= '</a></h2>'; |
|
144 |
} elseif (is_author()) { |
|
145 |
$content .= '<h1 class="page-title author">'; |
|
146 |
$author = get_the_author(); |
|
147 |
$content .= __('Author Archives: ', 'thematic'); |
|
148 |
$content .= '<span>'; |
|
149 |
$content .= $author; |
|
150 |
$content .= '</span></h1>'; |
|
151 |
} elseif (is_category()) { |
|
152 |
$content .= '<h1 class="page-title">'; |
|
153 |
$content .= __('Category Archives:', 'thematic'); |
|
154 |
$content .= ' <span>'; |
|
155 |
$content .= single_cat_title('', FALSE); |
|
156 |
$content .= '</span></h1>' . "\n"; |
|
157 |
$content .= '<div class="archive-meta">'; |
|
158 |
if ( !(''== category_description()) ) : $content .= apply_filters('archive_meta', category_description()); endif; |
|
159 |
$content .= '</div>'; |
|
160 |
} elseif (is_search()) { |
|
161 |
$content .= '<h1 class="page-title">'; |
|
162 |
$content .= __('Search Results for:', 'thematic'); |
|
163 |
$content .= ' <span id="search-terms">'; |
|
164 |
$content .= wp_specialchars(stripslashes($_GET['s']), true); |
|
165 |
$content .= '</span></h1>'; |
|
166 |
} elseif (is_tag()) { |
|
167 |
$content .= '<h1 class="page-title">'; |
|
168 |
$content .= __('Tag Archives:', 'thematic'); |
|
169 |
$content .= ' <span>'; |
|
170 |
$content .= __(thematic_tag_query()); |
|
171 |
$content .= '</span></h1>'; |
|
172 |
} elseif (is_day()) { |
|
173 |
$content .= '<h1 class="page-title">'; |
|
174 |
$content .= sprintf(__('Daily Archives: <span>%s</span>', 'thematic'), get_the_time(get_option('date_format'))); |
|
175 |
$content .= '</h1>'; |
|
176 |
} elseif (is_month()) { |
|
177 |
$content .= '<h1 class="page-title">'; |
|
178 |
$content .= sprintf(__('Monthly Archives: <span>%s</span>', 'thematic'), get_the_time('F Y')); |
|
179 |
$content .= '</h1>'; |
|
180 |
} elseif (is_year()) { |
|
181 |
$content .= '<h1 class="page-title">'; |
|
182 |
$content .= sprintf(__('Yearly Archives: <span>%s</span>', 'thematic'), get_the_time('Y')); |
|
183 |
$content .= '</h1>'; |
|
184 |
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { |
|
185 |
$content .= '<h1 class="page-title">'; |
|
186 |
$content .= __('Blog Archives', 'thematic'); |
|
187 |
$content .= '</h1>'; |
|
188 |
} |
|
189 |
$content .= "\n"; |
|
190 |
echo apply_filters('thematic_page_title', $content); |
|
191 |
} |
|
192 |
|
|
193 |
// Action to create the above navigation |
|
194 |
function thematic_nav_above() { |
|
195 |
if (is_single()) { ?> |
|
196 |
|
|
197 |
<div id="nav-above" class="navigation"> |
|
198 |
<div class="nav-previous"><?php thematic_previous_post_link() ?></div> |
|
199 |
<div class="nav-next"><?php thematic_next_post_link() ?></div> |
|
200 |
</div> |
|
201 |
|
|
202 |
<?php |
|
203 |
} else { ?> |
|
204 |
|
|
205 |
<div id="nav-above" class="navigation"> |
|
206 |
<?php if(function_exists('wp_pagenavi')) { ?> |
|
207 |
<?php wp_pagenavi(); ?> |
|
208 |
<?php } else { ?> |
|
209 |
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'thematic')) ?></div> |
|
210 |
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'thematic')) ?></div> |
|
211 |
<?php } ?> |
|
212 |
</div> |
|
213 |
|
|
214 |
<?php |
|
215 |
} |
|
216 |
} |
|
217 |
add_action('thematic_navigation_above', 'thematic_nav_above', 2); |
|
218 |
|
|
219 |
// The Archive Loop |
|
220 |
function thematic_archive_loop() { |
|
221 |
while ( have_posts() ) : the_post(); ?> |
|
222 |
|
|
223 |
<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>"> |
|
224 |
<?php thematic_postheader(); ?> |
|
225 |
<div class="entry-content"> |
|
226 |
<?php thematic_content(); ?> |
|
227 |
|
|
228 |
</div> |
|
229 |
<?php thematic_postfooter(); ?> |
|
230 |
</div><!-- .post --> |
|
231 |
|
|
232 |
<?php endwhile; |
|
233 |
} |
|
234 |
add_action('thematic_archiveloop', 'thematic_archive_loop'); |
|
235 |
|
|
236 |
// The Author Loop |
|
237 |
function thematic_author_loop() { |
|
238 |
rewind_posts(); |
|
239 |
while (have_posts()) : the_post(); ?> |
|
240 |
|
|
241 |
<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>"> |
|
242 |
<?php thematic_postheader(); ?> |
|
243 |
<div class="entry-content "> |
|
244 |
<?php thematic_content(); ?> |
|
245 |
|
|
246 |
</div> |
|
247 |
<?php thematic_postfooter(); ?> |
|
248 |
</div><!-- .post --> |
|
249 |
|
|
250 |
<?php endwhile; |
|
251 |
} |
|
252 |
add_action('thematic_authorloop', 'thematic_author_loop'); |
|
253 |
|
|
254 |
// The Category Loop |
|
255 |
function thematic_category_loop() { |
|
256 |
while (have_posts()) : the_post(); ?> |
|
257 |
|
|
258 |
<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>"> |
|
259 |
<?php thematic_postheader(); ?> |
|
260 |
<div class="entry-content"> |
|
261 |
<?php thematic_content(); ?> |
|
262 |
|
|
263 |
</div> |
|
264 |
<?php thematic_postfooter(); ?> |
|
265 |
</div><!-- .post --> |
|
266 |
|
|
267 |
<?php endwhile; |
|
268 |
} |
|
269 |
add_action('thematic_categoryloop', 'thematic_category_loop'); |
|
270 |
|
|
271 |
// The Index Loop |
|
272 |
function thematic_index_loop() { |
|
273 |
global $options; |
|
274 |
foreach ($options as $value) { |
|
275 |
if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } |
|
276 |
else { $$value['id'] = get_option( $value['id'] ); } |
|
277 |
} |
|
278 |
/* Count the number of posts so we can insert a widgetized area */ $count = 1; |
|
279 |
while ( have_posts() ) : the_post() ?> |
|
280 |
|
|
281 |
<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>"> |
|
282 |
<?php thematic_postheader(); ?> |
|
283 |
<div class="entry-content"> |
|
284 |
<?php thematic_content(); ?> |
|
285 |
|
|
286 |
<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?> |
|
287 |
</div> |
|
288 |
<?php thematic_postfooter(); ?> |
|
289 |
</div><!-- .post --> |
|
290 |
|
|
291 |
<?php comments_template(); |
|
292 |
|
|
293 |
if ($count==$thm_insert_position) { |
|
294 |
get_sidebar('index-insert'); |
|
295 |
} |
|
296 |
$count = $count + 1; |
|
297 |
endwhile; |
|
298 |
} |
|
299 |
add_action('thematic_indexloop', 'thematic_index_loop'); |
|
300 |
|
|
301 |
// The Single Post |
|
302 |
function thematic_single_post() { ?> |
|
303 |
<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>"> |
|
304 |
<?php thematic_postheader(); ?> |
|
305 |
<div class="entry-content"> |
|
306 |
<?php thematic_content(); ?> |
|
307 |
|
|
308 |
<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?> |
|
309 |
</div> |
|
310 |
<?php thematic_postfooter(); ?> |
|
311 |
</div><!-- .post --> |
|
312 |
<?php |
|
313 |
} |
|
314 |
add_action('thematic_singlepost', 'thematic_single_post'); |
|
315 |
|
|
316 |
// The Search Loop |
|
317 |
function thematic_search_loop() { |
|
318 |
while ( have_posts() ) : the_post(); ?> |
|
319 |
|
|
320 |
<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>"> |
|
321 |
<?php thematic_postheader(); ?> |
|
322 |
<div class="entry-content"> |
|
323 |
<?php thematic_content(); ?> |
|
324 |
|
|
325 |
</div> |
|
326 |
<?php thematic_postfooter(); ?> |
|
327 |
</div><!-- .post --> |
|
328 |
|
|
329 |
<?php endwhile; |
|
330 |
} |
|
331 |
add_action('thematic_searchloop', 'thematic_search_loop'); |
|
332 |
|
|
333 |
// The Tag Loop |
|
334 |
function thematic_tag_loop() { |
|
335 |
while (have_posts()) : the_post(); ?> |
|
336 |
|
|
337 |
<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>"> |
|
338 |
<?php thematic_postheader(); ?> |
|
339 |
<div class="entry-content"> |
|
340 |
<?php thematic_content() ?> |
|
341 |
|
|
342 |
</div> |
|
343 |
<?php thematic_postfooter(); ?> |
|
344 |
</div><!-- .post --> |
|
345 |
|
|
346 |
<?php endwhile; |
|
347 |
} |
|
348 |
add_action('thematic_tagloop', 'thematic_tag_loop'); |
|
349 |
|
|
350 |
// Filter to create the time url title displayed in Post Header |
|
351 |
function thematic_time_title() { |
|
352 |
|
|
353 |
$time_title = 'Y-m-d\TH:i:sO'; |
|
354 |
|
|
355 |
// Filters should return correct |
|
356 |
$time_title = apply_filters('thematic_time_title', $time_title); |
|
357 |
|
|
358 |
return $time_title; |
|
359 |
} // end thematic_time_title |
|
360 |
|
|
361 |
|
|
362 |
// Filter to create the time displayed in Post Header |
|
363 |
function thematic_time_display() { |
|
364 |
|
|
365 |
$time_display = get_option('date_format'); |
|
366 |
|
|
367 |
// Filters should return correct |
|
368 |
$time_display = apply_filters('thematic_time_display', $time_display); |
|
369 |
|
|
370 |
return $time_display; |
|
371 |
} // end thematic_time_display |
|
372 |
|
|
373 |
|
|
374 |
// Information in Post Header |
|
375 |
function thematic_postheader() { |
|
376 |
|
|
377 |
global $post; |
|
378 |
|
|
379 |
if ($post->post_type == 'page' || is_404()) { |
|
380 |
$postheader = thematic_postheader_posttitle(); |
|
381 |
} else { |
|
382 |
$postheader = thematic_postheader_posttitle() . thematic_postheader_postmeta(); |
|
383 |
} |
|
384 |
|
|
385 |
echo apply_filters( 'thematic_postheader', $postheader ); // Filter to override default post header |
|
386 |
} // end thematic_postheader |
|
387 |
|
|
388 |
// Create the post edit link |
|
389 |
function thematic_postheader_posteditlink() { |
|
390 |
|
|
391 |
global $id; |
|
392 |
|
|
393 |
$posteditlink = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id; |
|
394 |
$posteditlink .= '" title="' . __('Edit post', 'thematic') .'">'; |
|
395 |
$posteditlink .= __('Edit', 'thematic') . '</a>'; |
|
396 |
return apply_filters('thematic_postheader_posteditlink',$posteditlink); |
|
397 |
|
|
398 |
} // end thematic_postheader_posteditlink |
|
399 |
|
|
400 |
// Create post title |
|
401 |
function thematic_postheader_posttitle() { |
|
402 |
|
|
403 |
if (is_single() || is_page()) { |
|
404 |
$posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n"; |
|
405 |
} elseif (is_404()) { |
|
406 |
$posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n"; |
|
407 |
} else { |
|
408 |
$posttitle = '<h2 class="entry-title"><a href="'; |
|
409 |
$posttitle .= get_permalink(); |
|
410 |
$posttitle .= '" title="'; |
|
411 |
$posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0'); |
|
412 |
$posttitle .= '" rel="bookmark">'; |
|
413 |
$posttitle .= get_the_title(); |
|
414 |
$posttitle .= "</a></h2>\n"; |
|
415 |
} |
|
416 |
return apply_filters('thematic_postheader_posttitle',$posttitle); |
|
417 |
|
|
418 |
} // end thematic_postheader_posttitle |
|
419 |
|
|
420 |
// Create post meta |
|
421 |
function thematic_postheader_postmeta() { |
|
422 |
|
|
423 |
$postmeta = '<div class="entry-meta">'; |
|
424 |
$postmeta .= thematic_postmeta_authorlink(); |
|
425 |
$postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>'; |
|
426 |
$postmeta .= thematic_postmeta_entrydate(); |
|
427 |
|
|
428 |
$postmeta .= thematic_postmeta_editlink(); |
|
429 |
|
|
430 |
$postmeta .= "</div><!-- .entry-meta -->\n"; |
|
431 |
|
|
432 |
return apply_filters('thematic_postheader_postmeta',$postmeta); |
|
433 |
|
|
434 |
} // end thematic_postheader_postmeta |
|
435 |
|
|
436 |
// Create author link for post meta |
|
437 |
function thematic_postmeta_authorlink() { |
|
438 |
|
|
439 |
global $authordata; |
|
440 |
|
|
441 |
$authorlink = '<span class="meta-prep meta-prep-author">' . __('By ', 'thematic') . '</span>'; |
|
442 |
$authorlink .= '<span class="author vcard">'. '<a class="url fn n" href="'; |
|
443 |
$authorlink .= get_author_posts_url($authordata->ID, $authordata->user_nicename); |
|
444 |
$authorlink .= '" title="' . __('View all posts by ', 'thematic') . get_the_author() . '">'; |
|
445 |
$authorlink .= get_the_author(); |
|
446 |
$authorlink .= '</a></span>'; |
|
447 |
|
|
448 |
return apply_filters('thematic_post_meta_authorlink', $authorlink); |
|
449 |
|
|
450 |
} // end thematic_postmeta_authorlink() |
|
451 |
|
|
452 |
// Create entry date for post meta |
|
453 |
function thematic_postmeta_entrydate() { |
|
454 |
|
|
455 |
$entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>'; |
|
456 |
$entrydate .= '<span class="entry-date"><abbr class="published" title="'; |
|
457 |
$entrydate .= get_the_time(thematic_time_title()) . '">'; |
|
458 |
$entrydate .= get_the_time(thematic_time_display()); |
|
459 |
$entrydate .= '</abbr></span>'; |
|
460 |
|
|
461 |
return apply_filters('thematic_post_meta_entrydate', $entrydate); |
|
462 |
|
|
463 |
} // end thematic_postmeta_entrydate() |
|
464 |
|
|
465 |
// Create edit link for post meta |
|
466 |
function thematic_postmeta_editlink() { |
|
467 |
|
|
468 |
// Display edit link |
|
469 |
if (current_user_can('edit_posts')) { |
|
470 |
$editlink = ' <span class="meta-sep meta-sep-edit">|</span> ' . '<span class="edit">' . thematic_postheader_posteditlink() . '</span>'; |
|
471 |
return apply_filters('thematic_post_meta_editlink', $editlink); |
|
472 |
} |
|
473 |
|
|
474 |
} |
|
475 |
|
|
476 |
//creates the content |
|
477 |
function thematic_content() { |
|
478 |
|
|
479 |
if (is_home() || is_front_page()) { |
|
480 |
$content = 'full'; |
|
481 |
} elseif (is_single()) { |
|
482 |
$content = 'full'; |
|
483 |
} elseif (is_tag()) { |
|
484 |
$content = 'excerpt'; |
|
485 |
} elseif (is_search()) { |
|
486 |
$content = 'excerpt'; |
|
487 |
} elseif (is_category()) { |
|
488 |
$content = 'excerpt'; |
|
489 |
} elseif (is_author()) { |
|
490 |
$content = 'excerpt'; |
|
491 |
} elseif (is_archive()) { |
|
492 |
$content = 'excerpt'; |
|
493 |
} |
|
494 |
|
|
495 |
$content = apply_filters('thematic_content', $content); |
|
496 |
|
|
497 |
if ( strtolower($content) == 'full' ) { |
|
498 |
$post = get_the_content(more_text()); |
|
499 |
$post = apply_filters('the_content', $post); |
|
500 |
$post = str_replace(']]>', ']]>', $post); |
|
501 |
} elseif ( strtolower($content) == 'excerpt') { |
|
502 |
$post = get_the_excerpt(); |
|
503 |
} elseif ( strtolower($content) == 'none') { |
|
504 |
} else { |
|
505 |
$post = get_the_content(more_text()); |
|
506 |
$post = apply_filters('the_content', $post); |
|
507 |
$post = str_replace(']]>', ']]>', $post); |
|
508 |
} |
|
509 |
echo apply_filters('thematic_post', $post); |
|
510 |
} // end thematic_content |
|
511 |
|
|
512 |
// Functions that hook into thematic_archives() |
|
513 |
|
|
514 |
// Open .archives-page |
|
515 |
function thematic_archivesopen() { ?> |
|
516 |
<ul id="archives-page" class="xoxo"> |
|
517 |
<?php } |
|
518 |
add_action('thematic_archives', 'thematic_archivesopen', 1); |
|
519 |
|
|
520 |
// Display the Category Archives |
|
521 |
function thematic_category_archives() { ?> |
|
522 |
<li id="category-archives" class="content-column"> |
|
523 |
<h2><?php _e('Archives by Category', 'thematic') ?></h2> |
|
524 |
<ul> |
|
525 |
<?php wp_list_categories('optioncount=1&feed=RSS&title_li=&show_count=1') ?> |
|
526 |
</ul> |
|
527 |
</li> |
|
528 |
<?php } |
|
529 |
add_action('thematic_archives', 'thematic_category_archives', 3); |
|
530 |
|
|
531 |
// Display the Monthly Archives |
|
532 |
function thematic_monthly_archives() { ?> |
|
533 |
<li id="monthly-archives" class="content-column"> |
|
534 |
<h2><?php _e('Archives by Month', 'thematic') ?></h2> |
|
535 |
<ul> |
|
536 |
<?php wp_get_archives('type=monthly&show_post_count=1') ?> |
|
537 |
</ul> |
|
538 |
</li> |
|
539 |
<?php } |
|
540 |
add_action('thematic_archives', 'thematic_monthly_archives', 5); |
|
541 |
|
|
542 |
// Close .archives-page |
|
543 |
function thematic_archivesclose() { ?> |
|
544 |
</ul> |
|
545 |
<?php } |
|
546 |
add_action('thematic_archives', 'thematic_archivesclose', 9); |
|
547 |
|
|
548 |
// End of functions that hook into thematic_archives() |
|
549 |
|
|
550 |
|
|
551 |
// Action hook called in 404.php |
|
552 |
function thematic_404() { |
|
553 |
do_action('thematic_404'); |
|
554 |
} // end thematic_404 |
|
555 |
|
|
556 |
|
|
557 |
// 404 content injected into thematic_404 |
|
558 |
function thematic_404_content() { ?> |
|
559 |
<?php thematic_postheader(); ?> |
|
560 |
|
|
561 |
<div class="entry-content"> |
|
562 |
<p><?php _e('Apologies, but we were unable to find what you were looking for. Perhaps searching will help.', 'thematic') ?></p> |
|
563 |
</div> |
|
564 |
|
|
565 |
<form id="error404-searchform" method="get" action="<?php bloginfo('home') ?>"> |
|
566 |
<div> |
|
567 |
<input id="error404-s" name="s" type="text" value="<?php echo wp_specialchars(stripslashes($_GET['s']), true) ?>" size="40" /> |
|
568 |
<input id="error404-searchsubmit" name="searchsubmit" type="submit" value="<?php _e('Find', 'thematic') ?>" /> |
|
569 |
</div> |
|
570 |
</form> |
|
571 |
<?php } // end thematic_404_content |
|
572 |
|
|
573 |
add_action('thematic_404','thematic_404_content'); |
|
574 |
|
|
575 |
|
|
576 |
// creates the $more_link_text for the_content |
|
577 |
function more_text() { |
|
578 |
$content = ''.__('Read More <span class="meta-nav">»</span>', 'thematic').''; |
|
579 |
return apply_filters('more_text', $content); |
|
580 |
} // end more_text |
|
581 |
|
|
582 |
|
|
583 |
// creates the $more_link_text for the_content |
|
584 |
function list_bookmarks_args() { |
|
585 |
$content = 'title_before=<h2>&title_after=</h2>'; |
|
586 |
return apply_filters('list_bookmarks_args', $content); |
|
587 |
} // end more_text |
|
588 |
|
|
589 |
|
|
590 |
// Information in Post Footer |
|
591 |
function thematic_postfooter() { |
|
592 |
global $id, $post; |
|
593 |
|
|
594 |
if ($post->post_type == 'page' && current_user_can('edit_posts')) { /* For logged-in "page" search results */ |
|
595 |
$postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink(); |
|
596 |
$postfooter .= "</div><!-- .entry-utility -->\n"; |
|
597 |
} elseif ($post->post_type == 'page') { /* For logged-out "page" search results */ |
|
598 |
$postfooter = ''; |
|
599 |
} else { |
|
600 |
if (is_single()) { |
|
601 |
$postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postconnect(); |
|
602 |
} else { |
|
603 |
$postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postcomments(); |
|
604 |
} |
|
605 |
$postfooter .= "</div><!-- .entry-utility -->\n"; |
|
606 |
} |
|
607 |
|
|
608 |
// Put it on the screen |
|
609 |
echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer |
|
610 |
} // end thematic_postfooter |
|
611 |
|
|
612 |
// Create the post edit link |
|
613 |
function thematic_postfooter_posteditlink() { |
|
614 |
|
|
615 |
global $id; |
|
616 |
|
|
617 |
$posteditlink = '<span class="edit"><a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id; |
|
618 |
$posteditlink .= '" title="' . __('Edit post', 'thematic') .'">'; |
|
619 |
$posteditlink .= __('Edit', 'thematic') . '</a></span>'; |
|
620 |
return apply_filters('thematic_postfooter_posteditlink',$posteditlink); |
|
621 |
|
|
622 |
} // end thematic_postfooter_posteditlink |
|
623 |
|
|
624 |
// Create post category |
|
625 |
function thematic_postfooter_postcategory() { |
|
626 |
|
|
627 |
$postcategory = '<span class="cat-links">'; |
|
628 |
if (is_single()) { |
|
629 |
$postcategory .= __('This entry was posted in ', 'thematic') . get_the_category_list(', '); |
|
630 |
$postcategory .= '</span>'; |
|
631 |
} elseif ( is_category() && $cats_meow = thematic_cats_meow(', ') ) { /* Returns categories other than the one queried */ |
|
632 |
$postcategory .= __('Also posted in ', 'thematic') . $cats_meow; |
|
633 |
$postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>'; |
|
634 |
} else { |
|
635 |
$postcategory .= __('Posted in ', 'thematic') . get_the_category_list(', '); |
|
636 |
$postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>'; |
|
637 |
} |
|
638 |
return apply_filters('thematic_postfooter_postcategory',$postcategory); |
|
639 |
|
|
640 |
} // end thematic_postfooter_postcategory |
|
641 |
|
|
642 |
// Create post tags |
|
643 |
function thematic_postfooter_posttags() { |
|
644 |
|
|
645 |
if (is_single()) { |
|
646 |
$tagtext = __(' and tagged', 'thematic'); |
|
647 |
$posttags = get_the_tag_list("<span class=\"tag-links\"> $tagtext ",', ','</span>'); |
|
648 |
} elseif ( is_tag() && $tag_ur_it = thematic_tag_ur_it(', ') ) { /* Returns tags other than the one queried */ |
|
649 |
$posttags = '<span class="tag-links">' . __(' Also tagged ', 'thematic') . $tag_ur_it . '</span> <span class="meta-sep meta-sep-comments-link">|</span>'; |
|
650 |
} else { |
|
651 |
$tagtext = __('Tagged', 'thematic'); |
|
652 |
$posttags = get_the_tag_list("<span class=\"tag-links\"> $tagtext ",', ','</span> <span class="meta-sep meta-sep-comments-link">|</span>'); |
|
653 |
} |
|
654 |
return apply_filters('thematic_postfooter_posttags',$posttags); |
|
655 |
|
|
656 |
} // end thematic_postfooter_posttags |
|
657 |
|
|
658 |
// Create comments link and edit link |
|
659 |
function thematic_postfooter_postcomments() { |
|
660 |
if (comments_open()) { |
|
661 |
$postcommentnumber = get_comments_number(); |
|
662 |
if ($postcommentnumber > '1') { |
|
663 |
$postcomments = ' <span class="comments-link"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">'; |
|
664 |
$postcomments .= get_comments_number() . __(' Comments', 'thematic') . '</a></span>'; |
|
665 |
} elseif ($postcommentnumber == '1') { |
|
666 |
$postcomments = ' <span class="comments-link"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">'; |
|
667 |
$postcomments .= get_comments_number() . __(' Comment', 'thematic') . '</a></span>'; |
|
668 |
} elseif ($postcommentnumber == '0') { |
|
669 |
$postcomments = ' <span class="comments-link"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">'; |
|
670 |
$postcomments .= __('Leave a comment', 'thematic') . '</a></span>'; |
|
671 |
} |
|
672 |
} else { |
|
673 |
$postcomments = ' <span class="comments-link comments-closed-link">' . __('Comments closed', 'thematic') .'</span>'; |
|
674 |
} |
|
675 |
// Display edit link |
|
676 |
if (current_user_can('edit_posts')) { |
|
677 |
$postcomments .= ' <span class="meta-sep meta-sep-edit">|</span> ' . thematic_postfooter_posteditlink(); |
|
678 |
} |
|
679 |
return apply_filters('thematic_postfooter_postcomments',$postcomments); |
|
680 |
|
|
681 |
} // end thematic_postfooter_postcomments |
|
682 |
|
|
683 |
// Create permalink, comments link, and RSS on single posts |
|
684 |
function thematic_postfooter_postconnect() { |
|
685 |
|
|
686 |
$postconnect = __('. Bookmark the ', 'thematic') . '<a href="' . get_permalink() . '" title="' . __('Permalink to ', 'thematic') . the_title_attribute('echo=0') . '">'; |
|
687 |
$postconnect .= __('permalink', 'thematic') . '</a>.'; |
|
688 |
if ((comments_open()) && (pings_open())) { /* Comments are open */ |
|
689 |
$postconnect .= ' <a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('Post a comment', 'thematic') . '</a>'; |
|
690 |
$postconnect .= __(' or leave a trackback: ', 'thematic'); |
|
691 |
$postconnect .= '<a class="trackback-link" href="' . trackback_url(FALSE) . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.'; |
|
692 |
} elseif (!(comments_open()) && (pings_open())) { /* Only trackbacks are open */ |
|
693 |
$postconnect .= __(' Comments are closed, but you can leave a trackback: ', 'thematic'); |
|
694 |
$postconnect .= '<a class="trackback-link" href="' . trackback_url(FALSE) . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.'; |
|
695 |
} elseif ((comments_open()) && !(pings_open())) { /* Only comments open */ |
|
696 |
$postconnect .= __(' Trackbacks are closed, but you can ', 'thematic'); |
|
697 |
$postconnect .= '<a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('post a comment', 'thematic') . '</a>.'; |
|
698 |
} elseif (!(comments_open()) && !(pings_open())) { /* Comments and trackbacks closed */ |
|
699 |
$postconnect .= __(' Both comments and trackbacks are currently closed.', 'thematic'); |
|
700 |
} |
|
701 |
// Display edit link on single posts |
|
702 |
if (current_user_can('edit_posts')) { |
|
703 |
$postconnect .= ' ' . thematic_postfooter_posteditlink(); |
|
704 |
} |
|
705 |
return apply_filters('thematic_postfooter_postconnect',$postconnect); |
|
706 |
|
|
707 |
} // end thematic_postfooter_postconnect |
|
708 |
|
|
709 |
// Action to create the below navigation |
|
710 |
function thematic_nav_below() { |
|
711 |
if (is_single()) { ?> |
|
712 |
|
|
713 |
<div id="nav-below" class="navigation"> |
|
714 |
<div class="nav-previous"><?php thematic_previous_post_link() ?></div> |
|
715 |
<div class="nav-next"><?php thematic_next_post_link() ?></div> |
|
716 |
</div> |
|
717 |
|
|
718 |
<?php |
|
719 |
} else { ?> |
|
720 |
|
|
721 |
<div id="nav-below" class="navigation"> |
|
722 |
<?php if(function_exists('wp_pagenavi')) { ?> |
|
723 |
<?php wp_pagenavi(); ?> |
|
724 |
<?php } else { ?> |
|
725 |
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'thematic')) ?></div> |
|
726 |
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'thematic')) ?></div> |
|
727 |
<?php } ?> |
|
728 |
</div> |
|
729 |
|
|
730 |
<?php |
|
731 |
} |
|
732 |
} |
|
733 |
add_action('thematic_navigation_below', 'thematic_nav_below', 2); |
|
734 |
|
|
735 |
|
|
736 |
// creates the previous_post_link |
|
737 |
function thematic_previous_post_link() { |
|
738 |
$args = array ('format' => '%link', |
|
739 |
'link' => '<span class="meta-nav">«</span> %title', |
|
740 |
'in_same_cat' => FALSE, |
|
741 |
'excluded_categories' => ''); |
|
742 |
$args = apply_filters('thematic_previous_post_link_args', $args ); |
|
743 |
previous_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']); |
|
744 |
} // end thematic_previous_post_link |
|
745 |
|
|
746 |
|
|
747 |
// creates the next_post_link |
|
748 |
function thematic_next_post_link() { |
|
749 |
$args = array ('format' => '%link', |
|
750 |
'link' => '%title <span class="meta-nav">»</span>', |
|
751 |
'in_same_cat' => FALSE, |
|
752 |
'excluded_categories' => ''); |
|
753 |
$args = apply_filters('thematic_next_post_link_args', $args ); |
|
754 |
next_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']); |
|
755 |
} // end thematic_next_post_link |
|
756 |
|
|
757 |
|
|
758 |
// Produces an avatar image with the hCard-compliant photo class for author info |
|
759 |
function thematic_author_info_avatar() { |
|
760 |
global $wp_query; $curauth = $wp_query->get_queried_object(); |
|
761 |
$email = $curauth->user_email; |
|
762 |
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar("$email") ); |
|
763 |
echo $avatar; |
|
764 |
} // end thematic_author_info_avatar |
|
765 |
|
|
766 |
|
|
767 |
// For category lists on category archives: Returns other categories except the current one (redundant) |
|
768 |
function thematic_cats_meow($glue) { |
|
769 |
$current_cat = single_cat_title( '', false ); |
|
770 |
$separator = "\n"; |
|
771 |
$cats = explode( $separator, get_the_category_list($separator) ); |
|
772 |
foreach ( $cats as $i => $str ) { |
|
773 |
if ( strpos( $str, ">$current_cat<" ) > 0) { |
|
774 |
unset($cats[$i]); |
|
775 |
break; |
|
776 |
} |
|
777 |
} |
|
778 |
if ( empty($cats) ) |
|
779 |
return false; |
|
780 |
|
|
781 |
return trim(join( $glue, $cats )); |
|
782 |
} // end thematic_cats_meow |
|
783 |
|
|
784 |
|
|
785 |
// For tag lists on tag archives: Returns other tags except the current one (redundant) |
|
786 |
function thematic_tag_ur_it($glue) { |
|
787 |
$current_tag = single_tag_title( '', '', false ); |
|
788 |
$separator = "\n"; |
|
789 |
$tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) ); |
|
790 |
foreach ( $tags as $i => $str ) { |
|
791 |
if ( strpos( $str, ">$current_tag<" ) > 0 ) { |
|
792 |
unset($tags[$i]); |
|
793 |
break; |
|
794 |
} |
|
795 |
} |
|
796 |
if ( empty($tags) ) |
|
797 |
return false; |
|
798 |
|
|
799 |
return trim(join( $glue, $tags )); |
|
800 |
} // end thematic_tag_ur_it |
|
801 |
|
|
802 |
|
|
803 |
|
|
804 |
?> |