Advertisement
Guest User

Untitled

a guest
Nov 11th, 2010
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.65 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: FrontPage Test
  4. */
  5. get_header(); ?>
  6. <!-- Events Calendar Starts -->
  7. <?php if (!$paged && get_option('woo_events_calendar') == 'true') include (TEMPLATEPATH . "/includes/events-calendar.php"); ?>
  8. <!-- Events Calendar Ends -->
  9. <!-- Past Events Slider Starts -->
  10. <?php $showfeatured = get_option('woo_featured'); if ($showfeatured <> "true") update_option("woo_exclude", ""); ?>
  11. <?php if ( !$paged && $showfeatured == "true" ) include ( TEMPLATEPATH . '/includes/featured.php' ); ?>
  12. <!-- Past Events Slider Ends -->
  13. <?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')) { ?>
  14.  
  15. <div id="content" class="col-full">
  16. <p class="note">
  17. <?php _e('Please set up your theme options for your theme to render correctly.','woothemes'); ?>
  18. </p>
  19. </div>
  20. <?php } ?>
  21. <?php if (get_option('woo_blog_panel') == 'true') { ?>
  22. <div id="content" class="col-full">
  23. <div id="main" class="col-left">
  24. <?php if (get_option('woo_event_exclude') == 'true') { $category_id = get_cat_ID( get_option('woo_events_category') ); if ($category_id != 0) { $exclude_cat[0] = $category_id; } else { $exclude_cat[0] = ''; } } ?>
  25. <?php $i = 1; $cat_ids = explode(',',get_option('woo_blog_cat_exclude')); foreach ($cat_ids as $cat_id){ $exclude_cat[$i] = $cat_id; $i++; } ?>
  26. <?php if (get_option('woo_blog_featured_exclude') == 'true') { $exclude_posts = get_option('woo_exclude'); } ?>
  27. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post__not_in' => $exclude_posts, 'category__not_in' => $exclude_cat, 'paged' => $paged ); ?>
  28. <?php //query_posts($query_string . '&order=ASC');
  29.  
  30. // Here's where thus customised ordering of categories and limits per category gets done:
  31. $category_array = wp_tag_cloud('taxonomy=category&number=5&@h@orderby=custom&echo=0&format=array&largest=22&smallest=22' );
  32. global $post;
  33.  
  34. //set default number of posts per category here
  35. $default_numer_of_posts = 5;
  36. $num_posts_to_show_per_category = @h@(croer_get_limits('category'));
  37.  
  38.  
  39. $count = 0;
  40. $curr_parents = array('force first header');
  41. $curr_event_children = array();
  42. $event_name = 'Events';
  43.  
  44. foreach($category_array as $current_category){
  45.  
  46.  
  47. $term = get_term_by('slug', @h@sanitize_title($current_category), 'category' );
  48. $limit = @h@($num_posts_to_show_per_category[$term->term_id]) ? $num_posts_to_show_per_category[$term->term_id] : @h@$default_numer_of_posts;
  49. $current_posts = @h@query_posts('posts_per_page='.$limit.'&category_name='.sanitize_title($current_category));
  50. foreach($current_posts as $post) :
  51. setup_postdata($post);
  52. $count++;
  53.  
  54.  
  55. if (in_category( get_option('woo_events_category') )) { $is_event = true; } ?>
  56. <?php
  57. //Post Meta
  58. $event_start_date = get_post_meta($post->ID,'event_start_date',true);
  59. $event_end_date = get_post_meta($post->ID,'event_end_date',true);
  60. $event_start_time = get_post_meta($post->ID,'event_start_time',true);
  61. $event_end_time = get_post_meta($post->ID,'event_end_time',true);
  62. $event_location = get_post_meta($post->ID,'event_location',true);
  63. ?>
  64. <?php if ($is_event) { ?>
  65. <script type="text/javascript">
  66. jQuery(document).ready(function(){
  67.  
  68. jQuery('.add-calendar').each(function(){
  69. jQuery(this).parent().find('ul').hide();
  70. jQuery(this).click(function() {
  71. jQuery(this).parent().find('ul').toggle();
  72. });
  73. jQuery(this).parent().find('ul li').each(function() {
  74. jQuery(this).find('a').click(function() {
  75. jQuery(this).parent().parent().hide();
  76. });
  77. });
  78. });
  79. });
  80. </script>
  81. <?php if ($woo_booking_form == 'disabled') { ?>
  82. <style type="text/css">
  83. #events-calendar .event .buttons ul li.tip {
  84. left:18% !important;
  85. }
  86. </style>
  87. <?php } ?>
  88. <?php $js_formatting = stripslashes($woo_calendar_formatting); ?>
  89. <?php switch ($js_formatting) {
  90. /*case "mm/dd/yy" :
  91. $php_formatting = "m\/d\/Y";
  92. break;
  93. case "yy-mm-dd" :
  94. $php_formatting = "Y\-m\-d";
  95. break;
  96. case "d M, y" :
  97. $php_formatting = "d M, Y";
  98. break;
  99. case "d MM, y" :
  100. $php_formatting = "d F Y";
  101. break;
  102. case "DD, d MM, yy" :
  103. $php_formatting = "l, d F, Y";
  104. break;
  105. case "'day' d 'of' MM 'in the year' yy" :
  106. $php_formatting = "\\d\a\y d \\o\\f F \\i\\n \\t\h\e \\y\e\a\\r Y";
  107. break;*/
  108. default :
  109. $php_formatting = "m\/d\/Y";
  110. break;
  111. } ?>
  112. <?php } ?>
  113. <div class="box">
  114. <?php
  115. // Start of code to create headers
  116. $prev_parents = $curr_parents; $curr_parents = array();
  117. $prev_event_children = $curr_event_children; $curr_event_children = array();
  118. // Get the current parents and Event children (if any)
  119. foreach((get_the_category()) as $category) {
  120. $catname = $category->cat_name;
  121. if ($catname == 'Uncategorized') continue;
  122. if (!$category->parent) {
  123. $curr_parents[] = $catname;
  124. if ($catname == $event_name) {
  125. $termids = get_term_children($category->term_id,'category');
  126. foreach ($termids as $termid) {
  127. if (in_category($termid)) $curr_event_children[] = get_cat_name($termid);
  128. }
  129. }
  130. }
  131. }
  132. // Now, check for differences
  133. sort($curr_parents);
  134. sort($curr_event_children);
  135. $show_header = 0;
  136. if ($curr_parents != $prev_parents) {
  137. ++$show_header;
  138. } elseif (in_array($event_name,$curr_parents) &&
  139. ($curr_event_children != $prev_event_children)) {
  140. ++$show_header;
  141. }
  142. if ($show_header) {
  143. // Take $event_name out of parents array
  144. $temp_parents = array_diff($curr_parents,array($event_name));
  145. $output = implode($temp_parents,', ');
  146. if ($curr_event_children) {
  147. if ($output) $output .= ', ';
  148. $output .= implode($curr_event_children,', ');
  149. }
  150. echo '<div class="sectioncat">' . $output . '</div>';
  151. }
  152. $prev_parents = $curr_parents;
  153. $prev_event_children = $curr_event_children;
  154. // End of code for headers
  155. ?>
  156. <div class="singlepost">
  157. <div class="post">
  158. <?php the_post_thumbnail(array( 300, 9999 ), array('class' => 'alignleft post_thumbnail', 'alt' => 'alttext', 'title' => 'titletext')); ?>
  159. <div class="post-copy">
  160. <p class="locationhp">
  161. <?php $customField = get_post_custom_values("city"); if (isset($customField[0])) { echo "".$customField[0];}?>
  162. </p>
  163. <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  164. <?php the_title(); ?>
  165. </a></h2>
  166. <div class="datehp">
  167. <p class="startdate">
  168. <?php $customField = get_post_custom_values("dateandtime"); if (isset($customField[0])) { echo "".$customField[0];}?>
  169. </p>
  170. <p class="location">
  171. <?php $customField = get_post_custom_values("address"); if (isset($customField[0])) { echo "".$customField[0];}?>
  172. </p>
  173. </div>
  174. <?php if ( get_option('woo_post_content_archives') == "true" ) { ?>
  175. <div class="entry">
  176. <?php the_content(__('Read more...', 'woothemes')); ?>
  177. </div>
  178. <?php $video = woo_embed('width=525&height=300'); ?>
  179. <?php
  180. if (!empty($video)){ ?>
  181. <div class="video <?php echo $GLOBALS['single_align']; ?>"> <?php echo $video; ?> </div>
  182. <!-- /.image -->
  183. <?php } ?>
  184. <?php } else { ?>
  185. <div class="entry">
  186. <?php the_excerpt(); ?>
  187. </div>
  188. </div>
  189. <?php } ?>
  190. <div class="fix"></div>
  191. </div>
  192. <!-- /.post -->
  193. <div class="post-bottom">
  194. <div class="add-share">
  195. <?php do_action( 'addthis_widget' ); ?>
  196. </div>
  197. <div class="right-post"> <a href="<?php the_permalink() ?>" title="<?php _e('Read the full story','woothemes'); ?>" class="button readmore">
  198. <?php _e('Read more','woothemes'); ?>
  199. </a>
  200. <?php if (in_category('events')) : ?>
  201. <?php if (get_option('woo_events_ical_export') == 'true') { ?>
  202. <a onclick="" class="button add-calendar billboard">
  203. <?php _e('Add to Calendar', 'woothemes'); ?>
  204. </a>
  205. <?php $icalurl = woo_get_ical($post->ID,$php_formatting); ?>
  206. <ul>
  207. <li class="outlook"><a href="<?php echo $icalurl['ical']; ?>" title="Microsoft Outlook">Microsoft Outlook</a></li>
  208. <li class="ical"><a href="<?php echo $icalurl['ical']; ?>" title="Apple iCal">Apple iCal</a></li>
  209. <li class="google"><a href="<?php echo $icalurl['google']; ?>" target="_blank" title="Google Calendar">Google Calendar</a></li>
  210. <li class="tip">&nbsp;</li>
  211. </ul>
  212. <?php } ?>
  213. <?php endif; ?>
  214. </div>
  215. <div class="fix"></div>
  216. </div>
  217. <!-- /.post-bottom -->
  218. </div>
  219. </div>
  220. <!-- /.box --><?php
  221.  
  222. endforeach;
  223. }
  224.  
  225.  
  226.  
  227. ?>
  228.  
  229.  
  230.  
  231. <?php woo_pagenav(); ?>
  232. </div>
  233. <!-- /#main -->
  234. <?php get_sidebar('home'); ?>
  235. </div>
  236. <!-- /#content -->
  237. <?php } ?>
  238. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement