Advertisement
Guest User

Untitled

a guest
Jan 26th, 2011
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.41 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Email Test
  4. */
  5.  
  6. get_header();
  7.  
  8. // what page are we on?
  9. global $page;
  10. $thispage_no = ($page) ? $page : 1;
  11. ?>
  12. <!-- Events Calendar Starts -->
  13. <?php if (!$paged && get_option('woo_events_calendar') == 'true')
  14. include (TEMPLATEPATH . "/includes/events-calendar.php"); ?>
  15. <!-- Events Calendar Ends -->
  16. <!-- Past Events Slider Starts -->
  17. <?php
  18. $showfeatured = get_option('woo_featured');
  19. if ($showfeatured <> "true")
  20. update_option("woo_exclude", "");
  21. if (!$paged && $showfeatured == "true")
  22. include ( TEMPLATEPATH . '/includes/featured.php' ); ?>
  23. <!-- Past Events Slider Ends -->
  24. <?php if ((get_option('woo_events_calendar') != 'true') && (get_option('woo_featured') != 'true') && (get_option('woo_blog_panel') != 'true') && (get_option('woo_footer_panel') != 'true')) {
  25.  
  26. ?>
  27. <div id="content" class="col-full">
  28. <p class="note">
  29. <?php _e('Please set up your theme options for your theme to render correctly.', 'woothemes'); ?>
  30. </p>
  31. </div>
  32. <?php } ?>
  33. <?php if (get_option('woo_blog_panel') == 'true') {
  34. ?>
  35. <div id="content" class="col-full">
  36. <div id="main" class="col-left">
  37. <?php
  38. if (get_option('woo_event_exclude') == 'true') {
  39. $category_id = get_cat_ID(get_option('woo_events_category'));
  40. if ($category_id != 0) {
  41. $exclude_cat[0] = $category_id;
  42. } else {
  43. $exclude_cat[0] = '';
  44. }
  45. } ?>
  46. <?php
  47. $i = 1;
  48. $cat_ids = explode(',', get_option('woo_blog_cat_exclude'));
  49. foreach ($cat_ids as $cat_id) {
  50. $exclude_cat[$i] = $cat_id;
  51. $i++;
  52. } ?>
  53. <?php
  54. if (get_option('woo_blog_featured_exclude') == 'true') {
  55. $exclude_posts = get_option('woo_exclude');
  56. } ?>
  57. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  58. $args = array('post__not_in' => $exclude_posts, 'category__not_in' => $exclude_cat, 'paged' => $paged); ?>
  59. <?php
  60. //query_posts($query_string . '&order=ASC');
  61.  
  62. // Here's where the customised ordering of categories and limits per category gets done:
  63. $category_array = wp_tag_cloud('taxonomy=category&number=100&orderby=custom&echo=0&format=array&largest=22&smallest=22');
  64. // var_dump($category_array);
  65. // global $post, $wpdb;
  66. //set default number of posts to show per sorted category here
  67. $default_numer_of_posts = 2;
  68. $num_posts_to_show_per_category = 50; // <-- hard-coded, otherwise = (croer_get_limits('category'));
  69. $count = 0;
  70. $home_items_per_page = (get_option('woo_home_items_ppage'))? get_option('woo_home_items_ppage') :10;
  71. $num_posts_to_show_per_category = (get_option('woo_home_items_pcat'))? get_option('woo_home_items_pcat') :2;
  72. $curr_parents = array('force first header');
  73. $curr_children = array();
  74. //get all posts set to hide on frontpage with wp-hide plugin
  75. global $wpdb, $query_posts_flag;
  76. $posts_per_page = get_option('posts_per_page');
  77. $sql = "SELECT post_id
  78. FROM `" . $wpdb->prefix . "postmeta`
  79. WHERE `meta_key` = '_wplp_post_front'
  80. ORDER BY `" . $wpdb->prefix . "postmeta`.`post_id` ASC ";
  81. $result = mysql_query($sql);
  82. $hiddenposts = array();
  83. $posts_allready_shown = array();
  84. if ($result) {
  85. while ($row = mysql_fetch_assoc($result)) {
  86. $hiddenposts[] = $row['post_id'];
  87. }
  88. }
  89. foreach ($category_array as $current_category) {
  90. $term = get_term_by('slug', sanitize_title($current_category), 'category');
  91. $limit = ($num_posts_to_show_per_category[$term->term_id]) ? $num_posts_to_show_per_category[$term->term_id] : $default_numer_of_posts;
  92. //$current_posts = get_posts('posts_per_page=' . $limit . '&category_name=' . sanitize_title($current_category));
  93. $args = array(
  94. 'posts_per_page' => -1, // <-- show all, alternatively use for limit per category $limit,
  95. 'category_name' => sanitize_title($current_category),
  96. 'post__not_in' => array_merge($hiddenposts, $posts_allready_shown)
  97. );
  98. $query_posts_flag = true;
  99. _d('doing',$term->term_id);
  100. $current_posts = query_posts($args);
  101. $query_posts_flag = false;
  102. foreach ($current_posts as $post) :
  103. // LOOP starts
  104. setup_postdata($post);
  105. $posts_allready_shown[] = $post->ID;
  106. $count++;
  107. // pagination filter:
  108. // echo $count . ':' . $thispage_no;
  109. if (($count > $home_items_per_page * ($thispage_no - 1)) && ($count <= $home_items_per_page * $thispage_no)) {
  110. if (in_category(get_option('woo_events_category'))) {
  111. $is_event = true;
  112. }
  113. //Post Meta
  114. $event_start_date = get_post_meta($post->ID, 'event_start_date', true);
  115. $event_end_date = get_post_meta($post->ID, 'event_end_date', true);
  116. $event_start_time = get_post_meta($post->ID, 'event_start_time', true);
  117. $event_end_time = get_post_meta($post->ID, 'event_end_time', true);
  118. $event_location = get_post_meta($post->ID, 'event_location', true);
  119. ?>
  120. <?php if ($is_event) {
  121. ?>
  122. <script type="text/javascript">
  123. jQuery(document).ready(function(){
  124. jQuery('.add-calendar').each(function(){
  125. jQuery(this).parent().find('ul').hide();
  126. jQuery(this).click(function() {
  127. jQuery(this).parent().find('ul').toggle();
  128. });
  129. jQuery(this).parent().find('ul li').each(function() {
  130. jQuery(this).find('a').click(function() {
  131. jQuery(this).parent().parent().hide();
  132. });
  133. });
  134. });
  135. });
  136. </script>
  137. <?php if ($woo_booking_form == 'disabled') {
  138. ?>
  139. <style type="text/css">
  140. #events-calendar .event .buttons ul li.tip {
  141. left:18% !important;
  142. }
  143. </style>
  144. <?php } ?>
  145. <?php $js_formatting = stripslashes($woo_calendar_formatting); ?>
  146. <?php
  147. switch ($js_formatting) {
  148. /* case "mm/dd/yy" :
  149. $php_formatting = "m\/d\/Y";
  150. break;
  151. case "yy-mm-dd" :
  152. $php_formatting = "Y\-m\-d";
  153. break;
  154. case "d M, y" :
  155. $php_formatting = "d M, Y";
  156. break;
  157. case "d MM, y" :
  158. $php_formatting = "d F Y";
  159. break;
  160. case "DD, d MM, yy" :
  161. $php_formatting = "l, d F, Y";
  162. break;
  163. case "'day' d 'of' MM 'in the year' yy" :
  164. $php_formatting = "\\d\a\y d \\o\\f F \\i\\n \\t\h\e \\y\e\a\\r Y";
  165. break; */
  166. default :
  167. $php_formatting = "m\/d\/Y";
  168. break;
  169. } ?>
  170. <?php } ?>
  171. <div class="box">
  172. <?php
  173.  
  174. // Start of code to create headers
  175. $prev_parents = $curr_parents;
  176. $curr_parents = array();
  177. $prev_children = $curr_children;
  178. $curr_children = array();
  179.  
  180. // Get the current parents with no children
  181. // and children (if any)
  182. foreach ((get_the_category()) as $category) {
  183. $catname = $category->cat_name;
  184. if ($catname == 'Uncategorized')
  185. continue;
  186.  
  187. if (!$category->parent) {
  188. $termids = get_term_children($category->term_id, 'category');
  189. $has_children = 0;
  190. foreach ($termids as $termid) {
  191. if (in_category($termid)) {
  192. $curr_children[] = get_cat_name($termid);
  193. ++$has_children;
  194. }
  195. }
  196. if (!$has_children) $curr_parents[] = $catname;
  197. }
  198. }
  199.  
  200. // Now, check for differences
  201. sort($curr_parents);
  202. sort($curr_children);
  203. $show_header = 0;
  204. if ($curr_parents != $prev_parents) {
  205. ++$show_header;
  206. } elseif ($curr_children != $prev_children) {
  207. ++$show_header;
  208. }
  209. if ($show_header) {
  210. $output = implode($curr_parents, ', ');
  211. if ($curr_children) {
  212. if ($output) $output .= ', ';
  213. $output .= implode($curr_children, ', ');
  214. }
  215. echo '<div class="sectioncat"><img src="http://thisweekin.net/wp-content/uploads/2011/01/headspace.jpg">' . $output . '</div>';
  216. }
  217. $prev_parents = $curr_parents;
  218. $prev_children = $curr_children;
  219. // End of code for headers
  220. ?>
  221. <div class="singlepost">
  222. <div class="post">
  223. <table cellpadding="0" cellspacing="0 align="center">
  224. <tbody><tr>
  225. <td valign="top">
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>
  230. <?php the_post_thumbnail(array(300, 9999), array('class' => 'alignleft post_thumbnail', 'alt' => 'alttext', 'title' => 'titletext', 'align' => 'left', 'hspace'=>10)); ?>
  231.  
  232. <div class="post-copy">
  233. <p class="locationhp">
  234. <?php
  235. $customField = get_post_custom_values("city");
  236. if (isset($customField[0])) {
  237. echo "" . $customField[0];
  238. }
  239. ?>
  240. </p>
  241. <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  242. <?php the_title(); ?>
  243. </a></h2>
  244. <div class="datehp">
  245. <p class="startdate">
  246. <?php
  247. $customField = get_post_custom_values("dateandtime");
  248. if (isset($customField[0])) {
  249. echo "" . $customField[0];
  250. }
  251. ?>
  252. </p>
  253. <p class="location">
  254. <?php
  255. $customField = get_post_custom_values("address");
  256. if (isset($customField[0])) {
  257. echo "" . $customField[0];
  258. }
  259. ?>
  260. </p>
  261. </div>
  262. <?php if (get_option('woo_post_content_archives') == "true") {
  263. ?>
  264. <div class="entry">
  265. <?php the_content(__('Read more...', 'woothemes')); ?>
  266. </div>
  267. <?php $video = woo_embed('width=525&height=300'); ?>
  268. <?php if (!empty($video)) {
  269. ?>
  270. <div class="video <?php echo $GLOBALS['single_align']; ?>"> <?php echo $video; ?> </div>
  271. <!-- /.image -->
  272. <?php } ?>
  273. <?php } else {
  274. ?>
  275. <div class="entry">
  276. <?php the_excerpt(); ?>
  277. </div>
  278. </div>
  279. <?php } ?>
  280. </td>
  281. </tr></tbody></table>
  282. <div class="fix"></div>
  283. </div>
  284. <!-- /.post -->
  285.  
  286. <div class="post-bottom">
  287. <div class="add-share">
  288. <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
  289. </div>
  290. <div class="right-post"><a href="<?php the_permalink() ?>" title="<?php _e('Read the full story', 'woothemes'); ?>" class="button readmore">
  291. <?php _e('Read more', 'woothemes'); ?>
  292. </a>
  293. <?php if (in_category('events')) : ?>
  294. <?php if (get_option('woo_events_ical_export') == 'true') {
  295. ?>
  296. <a onclick="" class="button add-calendar billboard">
  297. <?php _e('Add to Calendar', 'woothemes'); ?>
  298. </a>
  299. <?php $icalurl = woo_get_ical($post->ID, $php_formatting); ?>
  300. <ul>
  301. <li class="outlook"><a href="<?php echo $icalurl['ical']; ?>" title="Microsoft Outlook">Microsoft Outlook</a></li>
  302. <li class="ical"><a href="<?php echo $icalurl['ical']; ?>" title="Apple iCal">Apple iCal</a></li>
  303. <li class="google"><a href="<?php echo $icalurl['google']; ?>" target="_blank" title="Google Calendar">Google Calendar</a></li>
  304. <li class="tip">&nbsp;</li>
  305. </ul>
  306. <?php } ?>
  307. <?php endif; ?>
  308. </div>
  309. <div class="fix"></div>
  310. </div>
  311. <!-- /.post-bottom -->
  312.  
  313. </div>
  314. </div>
  315. <!-- /.box -->
  316.  
  317. <?php
  318. } else {
  319. ?>. <?php
  320. }
  321. wp_reset_query();
  322. endforeach; // end LOOP
  323. }
  324. ?>
  325. <?php //wp_reset_query(); ?>
  326. <?php
  327. // woo_pagenav();
  328. //ASC: pagination hack
  329. ?>
  330. <div class="nav-entries">
  331. <?php if ($thispage_no > 1) {
  332. ?><div class="nav-prev fl"><a href="<?php bloginfo('url');
  333. echo '/page/' . ($thispage_no - 1 ); ?>">&laquo; Previous Page</a></div><?php } ?>
  334. <?php if ($count > $thispage_no * $home_items_per_page) {
  335. ?><div class="nav-next fr"><a href="<?php bloginfo('url');
  336. echo '/page/' . ($thispage_no + 1 ); ?>">Next Page &raquo;</a></div><?php } ?>
  337. <div class="fix"></div>
  338. </div>
  339. </div>
  340. <!-- /#main -->
  341. <?php get_sidebar('home'); ?>
  342. </div>
  343. <!-- /#content -->
  344. <?php }
  345. ?>
  346. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement