Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: FrontPage Test
- */
- get_header(); ?>
- <!-- Events Calendar Starts -->
- <?php if (!$paged && get_option('woo_events_calendar') == 'true') include (TEMPLATEPATH . "/includes/events-calendar.php"); ?>
- <!-- Events Calendar Ends -->
- <!-- Past Events Slider Starts -->
- <?php $showfeatured = get_option('woo_featured'); if ($showfeatured <> "true") update_option("woo_exclude", ""); ?>
- <?php if ( !$paged && $showfeatured == "true" ) include ( TEMPLATEPATH . '/includes/featured.php' ); ?>
- <!-- Past Events Slider Ends -->
- <?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')) { ?>
- <div id="content" class="col-full">
- <p class="note">
- <?php _e('Please set up your theme options for your theme to render correctly.','woothemes'); ?>
- </p>
- </div>
- <?php } ?>
- <?php if (get_option('woo_blog_panel') == 'true') { ?>
- <div id="content" class="col-full">
- <div id="main" class="col-left">
- <?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] = ''; } } ?>
- <?php $i = 1; $cat_ids = explode(',',get_option('woo_blog_cat_exclude')); foreach ($cat_ids as $cat_id){ $exclude_cat[$i] = $cat_id; $i++; } ?>
- <?php if (get_option('woo_blog_featured_exclude') == 'true') { $exclude_posts = get_option('woo_exclude'); } ?>
- <?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 ); ?>
- <?php //query_posts($query_string . '&order=ASC');
- // Here's where thus customised ordering of categories and limits per category gets done:
- $category_array = wp_tag_cloud('taxonomy=category&number=5&@h@orderby=custom&echo=0&format=array&largest=22&smallest=22' );
- global $post;
- //set default number of posts per category here
- $default_numer_of_posts = 5;
- $num_posts_to_show_per_category = @h@(croer_get_limits('category'));
- $count = 0;
- $curr_parents = array('force first header');
- $curr_event_children = array();
- $event_name = 'Events';
- foreach($category_array as $current_category){
- $term = get_term_by('slug', @h@sanitize_title($current_category), 'category' );
- $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;
- $current_posts = @h@query_posts('posts_per_page='.$limit.'&category_name='.sanitize_title($current_category));
- foreach($current_posts as $post) :
- setup_postdata($post);
- $count++;
- if (in_category( get_option('woo_events_category') )) { $is_event = true; } ?>
- <?php
- //Post Meta
- $event_start_date = get_post_meta($post->ID,'event_start_date',true);
- $event_end_date = get_post_meta($post->ID,'event_end_date',true);
- $event_start_time = get_post_meta($post->ID,'event_start_time',true);
- $event_end_time = get_post_meta($post->ID,'event_end_time',true);
- $event_location = get_post_meta($post->ID,'event_location',true);
- ?>
- <?php if ($is_event) { ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- jQuery('.add-calendar').each(function(){
- jQuery(this).parent().find('ul').hide();
- jQuery(this).click(function() {
- jQuery(this).parent().find('ul').toggle();
- });
- jQuery(this).parent().find('ul li').each(function() {
- jQuery(this).find('a').click(function() {
- jQuery(this).parent().parent().hide();
- });
- });
- });
- });
- </script>
- <?php if ($woo_booking_form == 'disabled') { ?>
- <style type="text/css">
- #events-calendar .event .buttons ul li.tip {
- left:18% !important;
- }
- </style>
- <?php } ?>
- <?php $js_formatting = stripslashes($woo_calendar_formatting); ?>
- <?php switch ($js_formatting) {
- /*case "mm/dd/yy" :
- $php_formatting = "m\/d\/Y";
- break;
- case "yy-mm-dd" :
- $php_formatting = "Y\-m\-d";
- break;
- case "d M, y" :
- $php_formatting = "d M, Y";
- break;
- case "d MM, y" :
- $php_formatting = "d F Y";
- break;
- case "DD, d MM, yy" :
- $php_formatting = "l, d F, Y";
- break;
- case "'day' d 'of' MM 'in the year' yy" :
- $php_formatting = "\\d\a\y d \\o\\f F \\i\\n \\t\h\e \\y\e\a\\r Y";
- break;*/
- default :
- $php_formatting = "m\/d\/Y";
- break;
- } ?>
- <?php } ?>
- <div class="box">
- <?php
- // Start of code to create headers
- $prev_parents = $curr_parents; $curr_parents = array();
- $prev_event_children = $curr_event_children; $curr_event_children = array();
- // Get the current parents and Event children (if any)
- foreach((get_the_category()) as $category) {
- $catname = $category->cat_name;
- if ($catname == 'Uncategorized') continue;
- if (!$category->parent) {
- $curr_parents[] = $catname;
- if ($catname == $event_name) {
- $termids = get_term_children($category->term_id,'category');
- foreach ($termids as $termid) {
- if (in_category($termid)) $curr_event_children[] = get_cat_name($termid);
- }
- }
- }
- }
- // Now, check for differences
- sort($curr_parents);
- sort($curr_event_children);
- $show_header = 0;
- if ($curr_parents != $prev_parents) {
- ++$show_header;
- } elseif (in_array($event_name,$curr_parents) &&
- ($curr_event_children != $prev_event_children)) {
- ++$show_header;
- }
- if ($show_header) {
- // Take $event_name out of parents array
- $temp_parents = array_diff($curr_parents,array($event_name));
- $output = implode($temp_parents,', ');
- if ($curr_event_children) {
- if ($output) $output .= ', ';
- $output .= implode($curr_event_children,', ');
- }
- echo '<div class="sectioncat">' . $output . '</div>';
- }
- $prev_parents = $curr_parents;
- $prev_event_children = $curr_event_children;
- // End of code for headers
- ?>
- <div class="singlepost">
- <div class="post">
- <?php the_post_thumbnail(array( 300, 9999 ), array('class' => 'alignleft post_thumbnail', 'alt' => 'alttext', 'title' => 'titletext')); ?>
- <div class="post-copy">
- <p class="locationhp">
- <?php $customField = get_post_custom_values("city"); if (isset($customField[0])) { echo "".$customField[0];}?>
- </p>
- <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
- <?php the_title(); ?>
- </a></h2>
- <div class="datehp">
- <p class="startdate">
- <?php $customField = get_post_custom_values("dateandtime"); if (isset($customField[0])) { echo "".$customField[0];}?>
- </p>
- <p class="location">
- <?php $customField = get_post_custom_values("address"); if (isset($customField[0])) { echo "".$customField[0];}?>
- </p>
- </div>
- <?php if ( get_option('woo_post_content_archives') == "true" ) { ?>
- <div class="entry">
- <?php the_content(__('Read more...', 'woothemes')); ?>
- </div>
- <?php $video = woo_embed('width=525&height=300'); ?>
- <?php
- if (!empty($video)){ ?>
- <div class="video <?php echo $GLOBALS['single_align']; ?>"> <?php echo $video; ?> </div>
- <!-- /.image -->
- <?php } ?>
- <?php } else { ?>
- <div class="entry">
- <?php the_excerpt(); ?>
- </div>
- </div>
- <?php } ?>
- <div class="fix"></div>
- </div>
- <!-- /.post -->
- <div class="post-bottom">
- <div class="add-share">
- <?php do_action( 'addthis_widget' ); ?>
- </div>
- <div class="right-post"> <a href="<?php the_permalink() ?>" title="<?php _e('Read the full story','woothemes'); ?>" class="button readmore">
- <?php _e('Read more','woothemes'); ?>
- </a>
- <?php if (in_category('events')) : ?>
- <?php if (get_option('woo_events_ical_export') == 'true') { ?>
- <a onclick="" class="button add-calendar billboard">
- <?php _e('Add to Calendar', 'woothemes'); ?>
- </a>
- <?php $icalurl = woo_get_ical($post->ID,$php_formatting); ?>
- <ul>
- <li class="outlook"><a href="<?php echo $icalurl['ical']; ?>" title="Microsoft Outlook">Microsoft Outlook</a></li>
- <li class="ical"><a href="<?php echo $icalurl['ical']; ?>" title="Apple iCal">Apple iCal</a></li>
- <li class="google"><a href="<?php echo $icalurl['google']; ?>" target="_blank" title="Google Calendar">Google Calendar</a></li>
- <li class="tip"> </li>
- </ul>
- <?php } ?>
- <?php endif; ?>
- </div>
- <div class="fix"></div>
- </div>
- <!-- /.post-bottom -->
- </div>
- </div>
- <!-- /.box --><?php
- endforeach;
- }
- ?>
- <?php woo_pagenav(); ?>
- </div>
- <!-- /#main -->
- <?php get_sidebar('home'); ?>
- </div>
- <!-- /#content -->
- <?php } ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement