Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 99 lines (76 sloc) 2.731 kB
1a5f038 @mathiasb Initial commit
authored
1 <?php
2 /*
3 Template Name: Timeline
4 */
5 ?>
6 <?php get_header(); ?>
7
8 <div class="row visible">
9
10 <?php if ( $woo_options[ 'woo_breadcrumbs_show' ] == 'true' ) { ?>
11 <?php woo_breadcrumbs(); ?>
12 <?php } ?>
13
14 <section id="content" role="content">
15
16 <?php query_posts( 'posts_per_page=-1' );
17 $dates_array = Array();
18 $year_array = Array();
19 $i = 0;
20 $prev_post_ts = null;
21 $prev_post_year = null;
22 $distance_multiplier = 9;
23 ?>
24
25 <div <?php post_class(); ?>>
26
27 <h1 class="title"><?php the_title(); ?></h1>
28
29 <div id="archives" class="entry">
30
31 <?php while (have_posts()) : the_post();
32
33 $post_ts = strtotime($post->post_date);
34 $post_year = date( 'Y', $post_ts );
35
36 /* Handle the first year as a special case */
37 if ( is_null( $prev_post_year ) ) {
38 ?>
39 <h3 class="archive_year"><?php echo $post_year?></h3>
40 <ul class="archives_list">
41 <?php
42 }
43 else if ( $prev_post_year != $post_year ) {
44 /* Close off the OL */
45 ?>
46 </ul>
47 <?php
48
49 $working_year = $prev_post_year;
50
51 /* Print year headings until we reach the post year */
52 while ( $working_year > $post_year ) {
53 $working_year--;
54 ?>
55 <h3 class="archive_year"><?php echo $working_year?></h3>
56 <?php
57 }
58
59 /* Open a new ordered list */
60 ?>
61 <ul class="archives_list">
62 <?php
63 }
64
65 /* Compute difference in days */
66 if ( ! is_null( $prev_post_ts ) && $prev_post_year == $post_year ) {
67 $dates_diff = ( date( 'z', $prev_post_ts ) - date( 'z', $post_ts ) ) * $distance_multiplier;
68 }
69 else {
70 $dates_diff = 0;
71 }
72 ?>
73 <li><span class="date"><?php the_time( 'F j' ); ?><sup><?php the_time( 'S') ?></sup></span> <span class="linked"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></span> <span class="comments"><?php comments_popup_link(__( 'Leave a comment', 'woothemes' ), __( '1 comment', 'woothemes' ), __( '% comments', 'woothemes' )); ?></span></li>
74 <?php
75 /* For subsequent iterations */
76 $prev_post_ts = $post_ts;
77 $prev_post_year = $post_year;
78 endwhile;
79
80 /* If we've processed at least *one* post, close the ordered list */
81 if ( ! is_null( $prev_post_ts ) ) {
82 ?>
83 </ul>
84 <?php } ?>
85
86 </div><!--entry-->
87
88 </div><!--post-->
89
90 </section><!-- /#content -->
91
92 <?php // wp_reset_query(); ?>
93
94 <?php get_sidebar(); ?>
95
96 </div><!-- /.row -->
97
98 <?php get_footer(); ?>
Something went wrong with that request. Please try again.