Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Email Test
- */
- get_header();
- // what page are we on?
- global $page;
- $thispage_no = ($page) ? $page : 1;
- ?>
- <!-- 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", "");
- 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 the customised ordering of categories and limits per category gets done:
- $category_array = wp_tag_cloud('taxonomy=category&number=100&orderby=custom&echo=0&format=array&largest=22&smallest=22');
- // var_dump($category_array);
- // global $post, $wpdb;
- //set default number of posts to show per sorted category here
- $default_numer_of_posts = 2;
- $num_posts_to_show_per_category = 50; // <-- hard-coded, otherwise = (croer_get_limits('category'));
- $count = 0;
- $home_items_per_page = (get_option('woo_home_items_ppage'))? get_option('woo_home_items_ppage') :10;
- $num_posts_to_show_per_category = (get_option('woo_home_items_pcat'))? get_option('woo_home_items_pcat') :2;
- $curr_parents = array('force first header');
- $curr_children = array();
- //get all posts set to hide on frontpage with wp-hide plugin
- global $wpdb, $query_posts_flag;
- $posts_per_page = get_option('posts_per_page');
- $sql = "SELECT post_id
- FROM `" . $wpdb->prefix . "postmeta`
- WHERE `meta_key` = '_wplp_post_front'
- ORDER BY `" . $wpdb->prefix . "postmeta`.`post_id` ASC ";
- $result = mysql_query($sql);
- $hiddenposts = array();
- $posts_allready_shown = array();
- if ($result) {
- while ($row = mysql_fetch_assoc($result)) {
- $hiddenposts[] = $row['post_id'];
- }
- }
- foreach ($category_array as $current_category) {
- $term = get_term_by('slug', sanitize_title($current_category), 'category');
- $limit = ($num_posts_to_show_per_category[$term->term_id]) ? $num_posts_to_show_per_category[$term->term_id] : $default_numer_of_posts;
- //$current_posts = get_posts('posts_per_page=' . $limit . '&category_name=' . sanitize_title($current_category));
- $args = array(
- 'posts_per_page' => -1, // <-- show all, alternatively use for limit per category $limit,
- 'category_name' => sanitize_title($current_category),
- 'post__not_in' => array_merge($hiddenposts, $posts_allready_shown)
- );
- $query_posts_flag = true;
- _d('doing',$term->term_id);
- $current_posts = query_posts($args);
- $query_posts_flag = false;
- foreach ($current_posts as $post) :
- // LOOP starts
- setup_postdata($post);
- $posts_allready_shown[] = $post->ID;
- $count++;
- // pagination filter:
- // echo $count . ':' . $thispage_no;
- if (($count > $home_items_per_page * ($thispage_no - 1)) && ($count <= $home_items_per_page * $thispage_no)) {
- if (in_category(get_option('woo_events_category'))) {
- $is_event = true;
- }
- //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_children = $curr_children;
- $curr_children = array();
- // Get the current parents with no children
- // and children (if any)
- foreach ((get_the_category()) as $category) {
- $catname = $category->cat_name;
- if ($catname == 'Uncategorized')
- continue;
- if (!$category->parent) {
- $termids = get_term_children($category->term_id, 'category');
- $has_children = 0;
- foreach ($termids as $termid) {
- if (in_category($termid)) {
- $curr_children[] = get_cat_name($termid);
- ++$has_children;
- }
- }
- if (!$has_children) $curr_parents[] = $catname;
- }
- }
- // Now, check for differences
- sort($curr_parents);
- sort($curr_children);
- $show_header = 0;
- if ($curr_parents != $prev_parents) {
- ++$show_header;
- } elseif ($curr_children != $prev_children) {
- ++$show_header;
- }
- if ($show_header) {
- $output = implode($curr_parents, ', ');
- if ($curr_children) {
- if ($output) $output .= ', ';
- $output .= implode($curr_children, ', ');
- }
- echo '<div class="sectioncat"><img src="http://thisweekin.net/wp-content/uploads/2011/01/headspace.jpg">' . $output . '</div>';
- }
- $prev_parents = $curr_parents;
- $prev_children = $curr_children;
- // End of code for headers
- ?>
- <div class="singlepost">
- <div class="post">
- <table cellpadding="0" cellspacing="0 align="center">
- <tbody><tr>
- <td valign="top">
- </td>
- </tr>
- <tr>
- <td>
- <?php the_post_thumbnail(array(300, 9999), array('class' => 'alignleft post_thumbnail', 'alt' => 'alttext', 'title' => 'titletext', 'align' => 'left', 'hspace'=>10)); ?>
- <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 } ?>
- </td>
- </tr></tbody></table>
- <div class="fix"></div>
- </div>
- <!-- /.post -->
- <div class="post-bottom">
- <div class="add-share">
- <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
- </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
- } else {
- ?>. <?php
- }
- wp_reset_query();
- endforeach; // end LOOP
- }
- ?>
- <?php //wp_reset_query(); ?>
- <?php
- // woo_pagenav();
- //ASC: pagination hack
- ?>
- <div class="nav-entries">
- <?php if ($thispage_no > 1) {
- ?><div class="nav-prev fl"><a href="<?php bloginfo('url');
- echo '/page/' . ($thispage_no - 1 ); ?>">« Previous Page</a></div><?php } ?>
- <?php if ($count > $thispage_no * $home_items_per_page) {
- ?><div class="nav-next fr"><a href="<?php bloginfo('url');
- echo '/page/' . ($thispage_no + 1 ); ?>">Next Page »</a></div><?php } ?>
- <div class="fix"></div>
- </div>
- </div>
- <!-- /#main -->
- <?php get_sidebar('home'); ?>
- </div>
- <!-- /#content -->
- <?php }
- ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement