/wp-content/themes/thematic/library/extensions/content-extensions.php

https://github.com/starbunks/Tito · PHP · 1250 lines · 895 code · 252 blank · 103 comment · 151 complexity · ef4fb32c8b9ac1ac279ef2eef77489fb MD5 · raw file

  1. <?php
  2. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  3. // links.php, page.php, search.php, single.php, tag.php
  4. // Just between #main and #container
  5. function thematic_abovecontainer() {
  6. do_action('thematic_abovecontainer');
  7. } // end thematic_abovecontainer
  8. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  9. // links.php, page.php, search.php, single.php, tag.php
  10. // Just between #main and #container
  11. function thematic_abovecontent() {
  12. do_action('thematic_abovecontent');
  13. } // end thematic_abovecontent
  14. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  15. // links.php, page.php, search.php, single.php, tag.php
  16. // Just between #main and #container
  17. function thematic_abovepost() {
  18. do_action('thematic_abovepost');
  19. } // end thematic_abovepost
  20. // Located in archives.php
  21. // Just after the content
  22. function thematic_archives() {
  23. do_action('thematic_archives');
  24. } // end thematic_archives
  25. // Located in archive.php, author.php, category.php, index.php, search.php, single.php, tag.php
  26. // Just before the content
  27. function thematic_navigation_above() {
  28. do_action('thematic_navigation_above');
  29. } // end thematic_navigation_above
  30. // Located in archive.php, author.php, category.php, index.php, search.php, single.php, tag.php
  31. // Just after the content
  32. function thematic_navigation_below() {
  33. do_action('thematic_navigation_below');
  34. } // end thematic_navigation_below
  35. // Located in index.php
  36. // Just before the loop
  37. function thematic_above_indexloop() {
  38. do_action('thematic_above_indexloop');
  39. } // end thematic_above_indexloop
  40. // Located in archive.php
  41. // The Loop
  42. function thematic_archiveloop() {
  43. do_action('thematic_archiveloop');
  44. } // end thematic_archiveloop
  45. // Located in author.php
  46. // The Loop
  47. function thematic_authorloop() {
  48. do_action('thematic_authorloop');
  49. } // end thematic_authorloop
  50. // Located in category.php
  51. // The Loop
  52. function thematic_categoryloop() {
  53. do_action('thematic_categoryloop');
  54. } // end thematic_categoryloop
  55. // Located in index.php
  56. // The Loop
  57. function thematic_indexloop() {
  58. do_action('thematic_indexloop');
  59. } // end thematic_indexloop
  60. // Located in search.php
  61. // The Loop
  62. function thematic_searchloop() {
  63. do_action('thematic_searchloop');
  64. } // end thematic_searchloop
  65. // Located in single.php
  66. // The Post
  67. function thematic_singlepost() {
  68. do_action('thematic_singlepost');
  69. } //end thematic_singlepost
  70. // Located in tag.php
  71. // The Loop
  72. function thematic_tagloop() {
  73. do_action('thematic_tagloop');
  74. } // end thematic_tagloop
  75. // Located in index.php
  76. // Just after the loop
  77. function thematic_below_indexloop() {
  78. do_action('thematic_below_indexloop');
  79. } // end thematic_below_indexloop
  80. // Located in category.php
  81. // Just before the loop
  82. function thematic_above_categoryloop() {
  83. do_action('thematic_above_categoryloop');
  84. } // end thematic_above_categoryloop
  85. // Located in category.php
  86. // Just after the loop
  87. function thematic_below_categoryloop() {
  88. do_action('thematic_below_categoryloop');
  89. } // end thematic_below_categoryloop
  90. // Located in search.php
  91. // Just before the loop
  92. function thematic_above_searchloop() {
  93. do_action('thematic_above_searchloop');
  94. } // end thematic_above_searchloop
  95. // Located in search.php
  96. // Just after the loop
  97. function thematic_below_searchloop() {
  98. do_action('thematic_below_searchloop');
  99. } // end thematic_below_searchloop
  100. // Located in tag.php
  101. // Just before the loop
  102. function thematic_above_tagloop() {
  103. do_action('thematic_above_tagloop');
  104. } // end thematic_above_tagloop
  105. // Located in tag.php
  106. // Just after the loop
  107. function thematic_below_tagloop() {
  108. do_action('thematic_below_tagloop');
  109. } // end thematic_below_tagloop
  110. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  111. // links.php, page.php, search.php, single.php, tag.php
  112. // Just below #content
  113. function thematic_belowpost() {
  114. do_action('thematic_belowpost');
  115. } // end thematic_belowpost
  116. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  117. // links.php, page.php, search.php, single.php, tag.php
  118. // Just below #content
  119. function thematic_belowcontent() {
  120. do_action('thematic_belowcontent');
  121. } // end thematic_belowcontent
  122. // Located in 404.php, archive.php, archives.php, attachement.php, author.php, category.php index.php,
  123. // links.php, page.php, search.php, single.php, tag.php
  124. // Just below #container
  125. function thematic_belowcontainer() {
  126. do_action('thematic_belowcontainer');
  127. } // end thematic_belowcontainer
  128. // Filter the page title
  129. // located in archive.php, attachement.php, author.php, category.php, search.php, tag.php
  130. if (function_exists('childtheme_override_page_title')) {
  131. function thematic_page_title() {
  132. childtheme_override_page_title();
  133. }
  134. } else {
  135. function thematic_page_title() {
  136. global $post;
  137. $content = '';
  138. if (is_attachment()) {
  139. $content .= '<h2 class="page-title"><a href="';
  140. $content .= apply_filters('the_permalink',get_permalink($post->post_parent));
  141. $content .= '" rev="attachment"><span class="meta-nav">&laquo; </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_meta( 'display_name' );
  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 .= esc_html(stripslashes($_GET['s']));
  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_tax()) {
  173. global $taxonomy;
  174. $content .= '<h1 class="page-title">';
  175. $tax = get_taxonomy($taxonomy);
  176. $content .= $tax->labels->name . ' ';
  177. $content .= __('Archives:', 'thematic');
  178. $content .= ' <span>';
  179. $content .= thematic_get_term_name();
  180. $content .= '</span></h1>';
  181. } elseif (is_day()) {
  182. $content .= '<h1 class="page-title">';
  183. $content .= sprintf(__('Daily Archives: <span>%s</span>', 'thematic'), get_the_time(get_option('date_format')));
  184. $content .= '</h1>';
  185. } elseif (is_month()) {
  186. $content .= '<h1 class="page-title">';
  187. $content .= sprintf(__('Monthly Archives: <span>%s</span>', 'thematic'), get_the_time('F Y'));
  188. $content .= '</h1>';
  189. } elseif (is_year()) {
  190. $content .= '<h1 class="page-title">';
  191. $content .= sprintf(__('Yearly Archives: <span>%s</span>', 'thematic'), get_the_time('Y'));
  192. $content .= '</h1>';
  193. } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
  194. $content .= '<h1 class="page-title">';
  195. $content .= __('Blog Archives', 'thematic');
  196. $content .= '</h1>';
  197. }
  198. $content .= "\n";
  199. echo apply_filters('thematic_page_title', $content);
  200. }
  201. }
  202. // Action to create the above navigation
  203. if (function_exists('childtheme_override_nav_above')) {
  204. function thematic_nav_above() {
  205. childtheme_override_nav_above();
  206. }
  207. } else {
  208. function thematic_nav_above() {
  209. if (is_single()) { ?>
  210. <div id="nav-above" class="navigation">
  211. <div class="nav-previous"><?php thematic_previous_post_link() ?></div>
  212. <div class="nav-next"><?php thematic_next_post_link() ?></div>
  213. </div>
  214. <?php
  215. } else { ?>
  216. <div id="nav-above" class="navigation">
  217. <?php if(function_exists('wp_pagenavi')) { ?>
  218. <?php wp_pagenavi(); ?>
  219. <?php } else { ?>
  220. <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'thematic')) ?></div>
  221. <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'thematic')) ?></div>
  222. <?php } ?>
  223. </div>
  224. <?php
  225. }
  226. }
  227. } // end nav_above
  228. add_action('thematic_navigation_above', 'thematic_nav_above', 2);
  229. // The Archive Loop
  230. if (function_exists('childtheme_override_archive_loop')) {
  231. function thematic_archive_loop() {
  232. childtheme_override_archive_loop();
  233. }
  234. } else {
  235. function thematic_archive_loop() {
  236. while ( have_posts() ) : the_post();
  237. thematic_abovepost(); ?>
  238. <div id="post-<?php the_ID();
  239. echo '" ';
  240. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  241. post_class();
  242. echo '>';
  243. } else {
  244. echo 'class="';
  245. thematic_post_class();
  246. echo '">';
  247. }
  248. thematic_postheader(); ?>
  249. <div class="entry-content">
  250. <?php thematic_content(); ?>
  251. </div><!-- .entry-content -->
  252. <?php thematic_postfooter(); ?>
  253. </div><!-- #post -->
  254. <?php
  255. thematic_belowpost();
  256. endwhile;
  257. }
  258. } // end archive_loop
  259. add_action('thematic_archiveloop', 'thematic_archive_loop');
  260. // The Author Loop
  261. if (function_exists('childtheme_override_author_loop')) {
  262. function thematic_author_loop() {
  263. childtheme_override_author_loop();
  264. }
  265. } else {
  266. function thematic_author_loop() {
  267. rewind_posts();
  268. while (have_posts()) : the_post();
  269. thematic_abovepost(); ?>
  270. <div id="post-<?php the_ID();
  271. echo '" ';
  272. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  273. post_class();
  274. echo '>';
  275. } else {
  276. echo 'class="';
  277. thematic_post_class();
  278. echo '">';
  279. }
  280. thematic_postheader(); ?>
  281. <div class="entry-content ">
  282. <?php thematic_content(); ?>
  283. </div><!-- .entry-content -->
  284. <?php thematic_postfooter(); ?>
  285. </div><!-- #post -->
  286. <?php
  287. thematic_belowpost();
  288. endwhile;
  289. }
  290. } // end author_loop
  291. add_action('thematic_authorloop', 'thematic_author_loop');
  292. // The Category Loop
  293. if (function_exists('childtheme_override_category_loop')) {
  294. function thematic_category_loop() {
  295. childtheme_override_category_loop();
  296. }
  297. } else {
  298. function thematic_category_loop() {
  299. while (have_posts()) : the_post();
  300. thematic_abovepost(); ?>
  301. <div id="post-<?php the_ID();
  302. echo '" ';
  303. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  304. post_class();
  305. echo '>';
  306. } else {
  307. echo 'class="';
  308. thematic_post_class();
  309. echo '">';
  310. }
  311. thematic_postheader(); ?>
  312. <div class="entry-content">
  313. <?php thematic_content(); ?>
  314. </div><!-- .entry-content -->
  315. <?php thematic_postfooter(); ?>
  316. </div><!-- #post -->
  317. <?php
  318. thematic_belowpost();
  319. endwhile;
  320. }
  321. } // end category_loop
  322. add_action('thematic_categoryloop', 'thematic_category_loop');
  323. // The Index Loop
  324. if (function_exists('childtheme_override_index_loop')) {
  325. function thematic_index_loop() {
  326. childtheme_override_index_loop();
  327. }
  328. } else {
  329. function thematic_index_loop() {
  330. global $options, $blog_id;
  331. foreach ($options as $value) {
  332. if (get_option( $value['id'] ) === FALSE) {
  333. $$value['id'] = $value['std'];
  334. } else {
  335. if (THEMATIC_MB)
  336. {
  337. $$value['id'] = get_option($blog_id, $value['id'] );
  338. }
  339. else
  340. {
  341. $$value['id'] = get_option( $value['id'] );
  342. }
  343. }
  344. }
  345. /* Count the number of posts so we can insert a widgetized area */ $count = 1;
  346. while ( have_posts() ) : the_post();
  347. thematic_abovepost(); ?>
  348. <div id="post-<?php the_ID();
  349. echo '" ';
  350. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  351. post_class();
  352. echo '>';
  353. } else {
  354. echo 'class="';
  355. thematic_post_class();
  356. echo '">';
  357. }
  358. thematic_postheader(); ?>
  359. <div class="entry-content">
  360. <?php thematic_content(); ?>
  361. <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
  362. </div><!-- .entry-content -->
  363. <?php thematic_postfooter(); ?>
  364. </div><!-- #post -->
  365. <?php
  366. thematic_belowpost();
  367. comments_template();
  368. if ($count==$thm_insert_position) {
  369. get_sidebar('index-insert');
  370. }
  371. $count = $count + 1;
  372. endwhile;
  373. }
  374. } // end index_loop
  375. add_action('thematic_indexloop', 'thematic_index_loop');
  376. // The Single Post
  377. if (function_exists('childtheme_override_single_post')) {
  378. function thematic_single_post() {
  379. childtheme_override_single_post();
  380. }
  381. } else {
  382. function thematic_single_post() {
  383. thematic_abovepost(); ?>
  384. <div id="post-<?php the_ID();
  385. echo '" ';
  386. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  387. post_class();
  388. echo '>';
  389. } else {
  390. echo 'class="';
  391. thematic_post_class();
  392. echo '">';
  393. }
  394. thematic_postheader(); ?>
  395. <div class="entry-content">
  396. <?php thematic_content(); ?>
  397. <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
  398. </div><!-- .entry-content -->
  399. <?php thematic_postfooter(); ?>
  400. </div><!-- #post -->
  401. <?php
  402. thematic_belowpost();
  403. }
  404. } // end single_post
  405. add_action('thematic_singlepost', 'thematic_single_post');
  406. // The Search Loop
  407. if (function_exists('childtheme_override_search_loop')) {
  408. function thematic_search_loop() {
  409. childtheme_override_search_loop();
  410. }
  411. } else {
  412. function thematic_search_loop() {
  413. while ( have_posts() ) : the_post();
  414. thematic_abovepost(); ?>
  415. <div id="post-<?php the_ID();
  416. echo '" ';
  417. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  418. post_class();
  419. echo '>';
  420. } else {
  421. echo 'class="';
  422. thematic_post_class();
  423. echo '">';
  424. }
  425. thematic_postheader(); ?>
  426. <div class="entry-content">
  427. <?php thematic_content(); ?>
  428. </div><!-- .entry-content -->
  429. <?php thematic_postfooter(); ?>
  430. </div><!-- #post -->
  431. <?php
  432. thematic_belowpost();
  433. endwhile;
  434. }
  435. } // end search_loop
  436. add_action('thematic_searchloop', 'thematic_search_loop');
  437. // The Tag Loop
  438. if (function_exists('childtheme_override_tag_loop')) {
  439. function thematic_tag_loop() {
  440. childtheme_override_tag_loop();
  441. }
  442. } else {
  443. function thematic_tag_loop() {
  444. while (have_posts()) : the_post();
  445. thematic_abovepost(); ?>
  446. <div id="post-<?php the_ID();
  447. echo '" ';
  448. if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
  449. post_class();
  450. echo '>';
  451. } else {
  452. echo 'class="';
  453. thematic_post_class();
  454. echo '">';
  455. }
  456. thematic_postheader(); ?>
  457. <div class="entry-content">
  458. <?php thematic_content() ?>
  459. </div><!-- .entry-content -->
  460. <?php thematic_postfooter(); ?>
  461. </div><!-- #post -->
  462. <?php
  463. thematic_belowpost();
  464. endwhile;
  465. }
  466. } // end tag_loop
  467. add_action('thematic_tagloop', 'thematic_tag_loop');
  468. // Filter to create the time url title displayed in Post Header
  469. function thematic_time_title() {
  470. $time_title = 'Y-m-d\TH:i:sO';
  471. // Filters should return correct
  472. $time_title = apply_filters('thematic_time_title', $time_title);
  473. return $time_title;
  474. } // end time_title
  475. // Filter to create the time displayed in Post Header
  476. function thematic_time_display() {
  477. $time_display = get_option('date_format');
  478. // Filters should return correct
  479. $time_display = apply_filters('thematic_time_display', $time_display);
  480. return $time_display;
  481. } // end time_display
  482. // Information in Post Header
  483. if (function_exists('childtheme_override_postheader')) {
  484. function thematic_postheader() {
  485. childtheme_override_postheader();
  486. }
  487. } else {
  488. function thematic_postheader() {
  489. global $post;
  490. if ( is_404() || $post->post_type == 'page') {
  491. $postheader = thematic_postheader_posttitle();
  492. } else {
  493. $postheader = thematic_postheader_posttitle() . thematic_postheader_postmeta();
  494. }
  495. echo apply_filters( 'thematic_postheader', $postheader ); // Filter to override default post header
  496. }
  497. } // end postheader
  498. // Create the post edit link
  499. if (function_exists('childtheme_override_postheader_posteditlink')) {
  500. function thematic_postheader_posteditlink() {
  501. return childtheme_override_postheader_posteditlink();
  502. }
  503. } else {
  504. function thematic_postheader_posteditlink() {
  505. global $id;
  506. $posteditlink = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&amp;post=' . $id;
  507. $posteditlink .= '" title="' . __('Edit post', 'thematic') .'">';
  508. $posteditlink .= __('Edit', 'thematic') . '</a>';
  509. return apply_filters('thematic_postheader_posteditlink',$posteditlink);
  510. }
  511. } // end postheader_posteditlink
  512. // Create post title
  513. if (function_exists('childtheme_override_postheader_posttitle')) {
  514. function thematic_postheader_posttitle() {
  515. return childtheme_override_postheader_posttitle();
  516. }
  517. } else {
  518. function thematic_postheader_posttitle() {
  519. if (is_single() || is_page()) {
  520. $posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n";
  521. } elseif (is_404()) {
  522. $posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n";
  523. } else {
  524. $posttitle = '<h2 class="entry-title"><a href="';
  525. $posttitle .= apply_filters('the_permalink', get_permalink());
  526. $posttitle .= '" title="';
  527. $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
  528. $posttitle .= '" rel="bookmark">';
  529. $posttitle .= get_the_title();
  530. $posttitle .= "</a></h2>\n";
  531. }
  532. return apply_filters('thematic_postheader_posttitle',$posttitle);
  533. }
  534. } // end postheader_posttitle
  535. // Create post meta
  536. if (function_exists('childtheme_override_postheader_postmeta')) {
  537. function thematic_postheader_postmeta() {
  538. return childtheme_override_postheader_postmeta();
  539. }
  540. } else {
  541. function thematic_postheader_postmeta() {
  542. $postmeta = '<div class="entry-meta">';
  543. $postmeta .= thematic_postmeta_authorlink();
  544. $postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>';
  545. $postmeta .= thematic_postmeta_entrydate();
  546. $postmeta .= thematic_postmeta_editlink();
  547. $postmeta .= "</div><!-- .entry-meta -->\n";
  548. return apply_filters('thematic_postheader_postmeta',$postmeta);
  549. }
  550. } // end postheader_postmeta
  551. // Create author link for post meta
  552. if (function_exists('childtheme_override_postmeta_authorlink')) {
  553. function thematic_postmeta_authorlink() {
  554. return childtheme_override_postmeta_authorlink();
  555. }
  556. } else {
  557. function thematic_postmeta_authorlink() {
  558. global $authordata;
  559. $authorlink = '<span class="meta-prep meta-prep-author">' . __('By ', 'thematic') . '</span>';
  560. $authorlink .= '<span class="author vcard">'. '<a class="url fn n" href="';
  561. $authorlink .= get_author_posts_url($authordata->ID, $authordata->user_nicename);
  562. $authorlink .= '" title="' . __('View all posts by ', 'thematic') . get_the_author_meta( 'display_name' ) . '">';
  563. $authorlink .= get_the_author_meta( 'display_name' );
  564. $authorlink .= '</a></span>';
  565. return apply_filters('thematic_post_meta_authorlink', $authorlink);
  566. }
  567. } // end postmeta_authorlink()
  568. // Create entry date for post meta
  569. if (function_exists('childtheme_override_postmeta_entrydate')) {
  570. function thematic_postmeta_entrydate() {
  571. return childtheme_override_postmeta_entrydate();
  572. }
  573. } else {
  574. function thematic_postmeta_entrydate() {
  575. $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>';
  576. $entrydate .= '<span class="entry-date"><abbr class="published" title="';
  577. $entrydate .= get_the_time(thematic_time_title()) . '">';
  578. $entrydate .= get_the_time(thematic_time_display());
  579. $entrydate .= '</abbr></span>';
  580. return apply_filters('thematic_post_meta_entrydate', $entrydate);
  581. }
  582. } // end postmeta_entrydate()
  583. // Create edit link for post meta
  584. if (function_exists('childtheme_override_postmeta_editlink')) {
  585. function thematic_postmeta_editlink() {
  586. return childtheme_override_postmeta_editlink();
  587. }
  588. } else {
  589. function thematic_postmeta_editlink() {
  590. // Display edit link
  591. if (current_user_can('edit_posts')) {
  592. $editlink = ' <span class="meta-sep meta-sep-edit">|</span> ' . '<span class="edit">' . thematic_postheader_posteditlink() . '</span>';
  593. return apply_filters('thematic_post_meta_editlink', $editlink);
  594. }
  595. }
  596. } // end postmeta_editlink
  597. // Sets up the post content
  598. if (function_exists('childtheme_override_content_init')) {
  599. function thematic_content_init() {
  600. childtheme_override_content_init();
  601. }
  602. } else {
  603. function thematic_content_init() {
  604. global $thematic_content_length;
  605. $content = '';
  606. $thematic_content_length = '';
  607. if (is_home() || is_front_page()) {
  608. $content = 'full';
  609. } elseif (is_single()) {
  610. $content = 'full';
  611. } elseif (is_tag()) {
  612. $content = 'excerpt';
  613. } elseif (is_search()) {
  614. $content = 'excerpt';
  615. } elseif (is_category()) {
  616. $content = 'excerpt';
  617. } elseif (is_author()) {
  618. $content = 'excerpt';
  619. } elseif (is_archive()) {
  620. $content = 'excerpt';
  621. }
  622. $thematic_content_length = apply_filters('thematic_content', $content);
  623. }
  624. add_action('thematic_abovepost','thematic_content_init');
  625. }
  626. // Creates the post content
  627. if (function_exists('childtheme_override_content')) {
  628. function thematic_content() {
  629. childtheme_override_content();
  630. }
  631. } else {
  632. function thematic_content() {
  633. global $thematic_content_length;
  634. if ( strtolower($thematic_content_length) == 'full' ) {
  635. $post = get_the_content(more_text());
  636. $post = apply_filters('the_content', $post);
  637. $post = str_replace(']]>', ']]&gt;', $post);
  638. } elseif ( strtolower($thematic_content_length) == 'excerpt') {
  639. $post = '';
  640. $post .= get_the_excerpt();
  641. $post = apply_filters('the_excerpt',$post);
  642. if ( apply_filters( 'thematic_post_thumbs', TRUE) ) {
  643. $post_title = get_the_title();
  644. $size = apply_filters( 'thematic_post_thumb_size' , array(100,100) );
  645. $attr = apply_filters( 'thematic_post_thumb_attr', array('title' => 'Permalink to ' . $post_title) );
  646. if ( has_post_thumbnail() ) {
  647. $post = '<a class="entry-thumb" href="' . get_permalink() . '" title="Permalink to ' . get_the_title() . '" >' . get_the_post_thumbnail(get_the_ID(), $size, $attr) . '</a>' . $post;
  648. }
  649. }
  650. } elseif ( strtolower($thematic_content_length) == 'none') {
  651. } else {
  652. $post = get_the_content(more_text());
  653. $post = apply_filters('the_content', $post);
  654. $post = str_replace(']]>', ']]&gt;', $post);
  655. }
  656. echo apply_filters('thematic_post', $post);
  657. }
  658. } // end content
  659. // Functions that hook into thematic_archives()
  660. // Open .archives-page
  661. if (function_exists('childtheme_override_archivesopen')) {
  662. function thematic_archivesopen() {
  663. childtheme_override_archivesopen();
  664. }
  665. } else {
  666. function thematic_archivesopen() { ?>
  667. <ul id="archives-page" class="xoxo">
  668. <?php }
  669. } // end archivesopen
  670. add_action('thematic_archives', 'thematic_archivesopen', 1);
  671. // Display the Category Archives
  672. if (function_exists('childtheme_override_category_archives')) {
  673. function thematic_category_archives() {
  674. childtheme_override_category_archives();
  675. }
  676. } else {
  677. function thematic_category_archives() { ?>
  678. <li id="category-archives" class="content-column">
  679. <h2><?php _e('Archives by Category', 'thematic') ?></h2>
  680. <ul>
  681. <?php wp_list_categories('optioncount=1&feed=RSS&title_li=&show_count=1') ?>
  682. </ul>
  683. </li>
  684. <?php }
  685. } // end category_archives
  686. add_action('thematic_archives', 'thematic_category_archives', 3);
  687. // Display the Monthly Archives
  688. if (function_exists('childtheme_override_monthly_archives')) {
  689. function thematic_monthly_archives() {
  690. childtheme_override_monthly_archives();
  691. }
  692. } else {
  693. function thematic_monthly_archives() { ?>
  694. <li id="monthly-archives" class="content-column">
  695. <h2><?php _e('Archives by Month', 'thematic') ?></h2>
  696. <ul>
  697. <?php wp_get_archives('type=monthly&show_post_count=1') ?>
  698. </ul>
  699. </li>
  700. <?php }
  701. } // end monthly_archives
  702. add_action('thematic_archives', 'thematic_monthly_archives', 5);
  703. // Close .archives-page
  704. if (function_exists('childtheme_override_archivesclose')) {
  705. function thematic_archivesclose() {
  706. childtheme_override_archivesclose();
  707. }
  708. } else {
  709. function thematic_archivesclose() { ?>
  710. </ul>
  711. <?php }
  712. } // end _archivesclose
  713. add_action('thematic_archives', 'thematic_archivesclose', 9);
  714. // End of functions that hook into thematic_archives()
  715. // Action hook called in 404.php
  716. function thematic_404() {
  717. do_action('thematic_404');
  718. } // end thematic_404
  719. // 404 content injected into thematic_404
  720. if (function_exists('childtheme_override_404_content')) {
  721. function thematic_404_content() {
  722. childtheme_override_404_content();
  723. }
  724. } else {
  725. function thematic_404_content() { ?>
  726. <?php thematic_postheader(); ?>
  727. <div class="entry-content">
  728. <p><?php _e('Apologies, but we were unable to find what you were looking for. Perhaps searching will help.', 'thematic') ?></p>
  729. </div><!-- .entry-content -->
  730. <form id="error404-searchform" method="get" action="<?php bloginfo('url') ?>/">
  731. <div>
  732. <input id="error404-s" name="s" type="text" value="<?php echo esc_html(stripslashes(get_query_var('s'))) ?>" size="40" />
  733. <input id="error404-searchsubmit" name="searchsubmit" type="submit" value="<?php _e('Find', 'thematic') ?>" />
  734. </div>
  735. </form>
  736. <?php }
  737. } // end 404_content
  738. add_action('thematic_404','thematic_404_content');
  739. // creates the $more_link_text for the_content
  740. function more_text() {
  741. $content = ''.__('Read More <span class="meta-nav">&raquo;</span>', 'thematic').'';
  742. return apply_filters('more_text', $content);
  743. } // end more_text
  744. // creates the $more_link_text for the_content
  745. function list_bookmarks_args() {
  746. $content = 'title_before=<h2>&title_after=</h2>';
  747. return apply_filters('list_bookmarks_args', $content);
  748. } // end list_bookmarks_args
  749. // Information in Post Footer
  750. if (function_exists('childtheme_override_postfooter')) {
  751. function thematic_postfooter() {
  752. childtheme_override_postfooter();
  753. }
  754. } else {
  755. function thematic_postfooter() {
  756. global $id, $post;
  757. if ($post->post_type == 'page' && current_user_can('edit_posts')) { /* For logged-in "page" search results */
  758. $postfooter = '<div class="entry-utility">' . thematic_postfooter_posteditlink();
  759. $postfooter .= "</div><!-- .entry-utility -->\n";
  760. } elseif ($post->post_type == 'page') { /* For logged-out "page" search results */
  761. $postfooter = '';
  762. } else {
  763. if (is_single()) {
  764. $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postconnect();
  765. } else {
  766. $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postcomments();
  767. }
  768. $postfooter .= "</div><!-- .entry-utility -->\n";
  769. }
  770. // Put it on the screen
  771. echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer
  772. }
  773. } // end postfooter
  774. // Create the post edit link
  775. if (function_exists('childtheme_override_postfooter_posteditlink')) {
  776. function thematic_postfooter_posteditlink() {
  777. return childtheme_override_postfooter_posteditlink();
  778. }
  779. } else {
  780. function thematic_postfooter_posteditlink() {
  781. global $id;
  782. $posteditlink = '<span class="edit"><a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&amp;post=' . $id;
  783. $posteditlink .= '" title="' . __('Edit post', 'thematic') .'">';
  784. $posteditlink .= __('Edit', 'thematic') . '</a></span>';
  785. return apply_filters('thematic_postfooter_posteditlink',$posteditlink);
  786. }
  787. } // end postfooter_posteditlink
  788. // Create post category
  789. if (function_exists('childtheme_override_postfooter_postcategory')) {
  790. function thematic_postfooter_postcategory() {
  791. return childtheme_override_postfooter_postcategory();
  792. }
  793. } else {
  794. function thematic_postfooter_postcategory() {
  795. $postcategory = '<span class="cat-links">';
  796. if (is_single()) {
  797. $postcategory .= __('This entry was posted in ', 'thematic') . get_the_category_list(', ');
  798. $postcategory .= '</span>';
  799. } elseif ( is_category() && $cats_meow = thematic_cats_meow(', ') ) { /* Returns categories other than the one queried */
  800. $postcategory .= __('Also posted in ', 'thematic') . $cats_meow;
  801. $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
  802. } else {
  803. $postcategory .= __('Posted in ', 'thematic') . get_the_category_list(', ');
  804. $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
  805. }
  806. return apply_filters('thematic_postfooter_postcategory',$postcategory);
  807. }
  808. } // end postfooter_postcategory
  809. // Create post tags
  810. if (function_exists('childtheme_override_postfooter_posttags')) {
  811. function thematic_postfooter_posttags() {
  812. return childtheme_override_postfooter_posttags();
  813. }
  814. } else {
  815. function thematic_postfooter_posttags() {
  816. if (is_single()) {
  817. $tagtext = __(' and tagged', 'thematic');
  818. $posttags = get_the_tag_list("<span class=\"tag-links\"> $tagtext ",', ','</span>');
  819. } elseif ( is_tag() && $tag_ur_it = thematic_tag_ur_it(', ') ) { /* Returns tags other than the one queried */
  820. $posttags = '<span class="tag-links">' . __(' Also tagged ', 'thematic') . $tag_ur_it . '</span> <span class="meta-sep meta-sep-comments-link">|</span>';
  821. } else {
  822. $tagtext = __('Tagged', 'thematic');
  823. $posttags = get_the_tag_list("<span class=\"tag-links\"> $tagtext ",', ','</span> <span class="meta-sep meta-sep-comments-link">|</span>');
  824. }
  825. return apply_filters('thematic_postfooter_posttags',$posttags);
  826. }
  827. } // end postfooter_posttags
  828. // Create comments link and edit link
  829. if (function_exists('childtheme_override_postfooter_postcomments')) {
  830. function thematic_postfooter_postcomments() {
  831. return childtheme_override_postfooter_postcomments();
  832. }
  833. } else {
  834. function thematic_postfooter_postcomments() {
  835. if (comments_open()) {
  836. $postcommentnumber = get_comments_number();
  837. if ($postcommentnumber > '1') {
  838. $postcomments = ' <span class="comments-link"><a href="' . apply_filters('the_permalink', get_permalink()) . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
  839. $postcomments .= get_comments_number() . __(' Comments', 'thematic') . '</a></span>';
  840. } elseif ($postcommentnumber == '1') {
  841. $postcomments = ' <span class="comments-link"><a href="' . apply_filters('the_permalink', get_permalink()) . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
  842. $postcomments .= get_comments_number() . __(' Comment', 'thematic') . '</a></span>';
  843. } elseif ($postcommentnumber == '0') {
  844. $postcomments = ' <span class="comments-link"><a href="' . apply_filters('the_permalink', get_permalink()) . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
  845. $postcomments .= __('Leave a comment', 'thematic') . '</a></span>';
  846. }
  847. } else {
  848. $postcomments = ' <span class="comments-link comments-closed-link">' . __('Comments closed', 'thematic') .'</span>';
  849. }
  850. // Display edit link
  851. if (current_user_can('edit_posts')) {
  852. $postcomments .= ' <span class="meta-sep meta-sep-edit">|</span> ' . thematic_postfooter_posteditlink();
  853. }
  854. return apply_filters('thematic_postfooter_postcomments',$postcomments);
  855. }
  856. } // end postfooter_postcomments
  857. // Create permalink, comments link, and RSS on single posts
  858. if (function_exists('childtheme_override_postfooter_postconnect')) {
  859. function thematic_postfooter_postconnect() {
  860. return childtheme_override_postfooter_postconnect();
  861. }
  862. } else {
  863. function thematic_postfooter_postconnect() {
  864. $postconnect = __('. Bookmark the ', 'thematic') . '<a href="' . apply_filters('the_permalink', get_permalink()) . '" title="' . __('Permalink to ', 'thematic') . the_title_attribute('echo=0') . '">';
  865. $postconnect .= __('permalink', 'thematic') . '</a>.';
  866. if ((comments_open()) && (pings_open())) { /* Comments are open */
  867. $postconnect .= ' <a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('Post a comment', 'thematic') . '</a>';
  868. $postconnect .= __(' or leave a trackback: ', 'thematic');
  869. $postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
  870. } elseif (!(comments_open()) && (pings_open())) { /* Only trackbacks are open */
  871. $postconnect .= __(' Comments are closed, but you can leave a trackback: ', 'thematic');
  872. $postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
  873. } elseif ((comments_open()) && !(pings_open())) { /* Only comments open */
  874. $postconnect .= __(' Trackbacks are closed, but you can ', 'thematic');
  875. $postconnect .= '<a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('post a comment', 'thematic') . '</a>.';
  876. } elseif (!(comments_open()) && !(pings_open())) { /* Comments and trackbacks closed */
  877. $postconnect .= __(' Both comments and trackbacks are currently closed.', 'thematic');
  878. }
  879. // Display edit link on single posts
  880. if (current_user_can('edit_posts')) {
  881. $postconnect .= ' ' . thematic_postfooter_posteditlink();
  882. }
  883. return apply_filters('thematic_postfooter_postconnect',$postconnect);
  884. }
  885. } // end postfooter_postconnect
  886. // Action to create the below navigation
  887. if (function_exists('childtheme_override_nav_below')) {
  888. function thematic_nav_below() {
  889. childtheme_override_nav_below();
  890. }
  891. } else {
  892. function thematic_nav_below() {
  893. if (is_single()) { ?>
  894. <div id="nav-below" class="navigation">
  895. <div class="nav-previous"><?php thematic_previous_post_link() ?></div>
  896. <div class="nav-next"><?php thematic_next_post_link() ?></div>
  897. </div>
  898. <?php
  899. } else { ?>
  900. <div id="nav-below" class="navigation">
  901. <?php if(function_exists('wp_pagenavi')) { ?>
  902. <?php wp_pagenavi(); ?>
  903. <?php } else { ?>
  904. <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'thematic')) ?></div>
  905. <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'thematic')) ?></div>
  906. <?php } ?>
  907. </div>
  908. <?php
  909. }
  910. }
  911. } // end nav_below
  912. add_action('thematic_navigation_below', 'thematic_nav_below', 2);
  913. // Creates the previous_post_link
  914. if (function_exists('childtheme_override_previous_post_link')) {
  915. function thematic_previous_post_link() {
  916. childtheme_override_previous_post_link();
  917. }
  918. } else {
  919. function thematic_previous_post_link() {
  920. $args = array ('format' => '%link',
  921. 'link' => '<span class="meta-nav">&laquo;</span> %title',
  922. 'in_same_cat' => FALSE,
  923. 'excluded_categories' => '');
  924. $args = apply_filters('thematic_previous_post_link_args', $args );
  925. previous_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']);
  926. }
  927. } // end previous_post_link
  928. // Creates the next_post_link
  929. if (function_exists('childtheme_override_next_post_link')) {
  930. function thematic_next_post_link() {
  931. childtheme_override_next_post_link();
  932. }
  933. } else {
  934. function thematic_next_post_link() {
  935. $args = array ('format' => '%link',
  936. 'link' => '%title <span class="meta-nav">&raquo;</span>',
  937. 'in_same_cat' => FALSE,
  938. 'excluded_categories' => '');
  939. $args = apply_filters('thematic_next_post_link_args', $args );
  940. next_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']);
  941. }
  942. } // end next_post_link
  943. // Produces an avatar image with the hCard-compliant photo class for author info
  944. if (function_exists('childtheme_override_author_info_avatar')) {
  945. function thematic_author_info_avatar() {
  946. childtheme_override_author_info_avatar();
  947. }
  948. } else {
  949. function thematic_author_info_avatar() {
  950. global $wp_query; $curauth = $wp_query->get_queried_object();
  951. $email = $curauth->user_email;
  952. $avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar("$email") );
  953. echo $avatar;
  954. }
  955. } // end author_info_avatar
  956. // For category lists on category archives: Returns other categories except the current one (redundant)
  957. if (function_exists('childtheme_override_cats_meow')) {
  958. function thematic_cats_meow() {
  959. return childtheme_override_cats_meow();
  960. }
  961. } else {
  962. function thematic_cats_meow($glue) {
  963. $current_cat = single_cat_title( '', false );
  964. $separator = "\n";
  965. $cats = explode( $separator, get_the_category_list($separator) );
  966. foreach ( $cats as $i => $str ) {
  967. if ( strpos( $str, ">$current_cat<" ) > 0) {
  968. unset($cats[$i]);
  969. break;
  970. }
  971. }
  972. if ( empty($cats) )
  973. return false;
  974. return trim(join( $glue, $cats ));
  975. }
  976. } // end cats_meow
  977. // For tag lists on tag archives: Returns other tags except the current one (redundant)
  978. if (function_exists('childtheme_override_tag_ur_it')) {
  979. function thematic_tag_ur_it() {
  980. return childtheme_override_tag_ur_it();
  981. }
  982. } else {
  983. function thematic_tag_ur_it($glue) {
  984. $current_tag = single_tag_title( '', '', false );
  985. $separator = "\n";
  986. $tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) );
  987. foreach ( $tags as $i => $str ) {
  988. if ( strpos( $str, ">$current_tag<" ) > 0 ) {
  989. unset($tags[$i]);
  990. break;
  991. }
  992. }
  993. if ( empty($tags) )
  994. return false;
  995. return trim(join( $glue, $tags ));
  996. }
  997. } // end thematic_tag_ur_it
  998. ?>