Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 196 lines (119 sloc) 6.334 kb
217f7fd Importing the News theme files and folders.
greenshady authored
1 <?php
2 /**
3 * Template Name: Home
4 *
5 * Used as a news-type home page. It lists a featured section at the top and pulls in the sidebar-feature.php
6 * file to sit beside the featured area. In the normal content area, posts are listed by category. These
7 * categories must be selected in the 'Home Template Settings' section of the 'News Settings' page. After
8 * the category highlight section, a more articles section displays a set number of posts.
9 *
10 * @package News
11 * @subpackage Template
12 */
13
14 /* Set up a default array for posts we're not duplicating. */
15 $do_not_duplicate = array();
16
17 get_header(); ?>
18
19 <!-- Begin feature area. -->
20 <div id="feature">
21
22 <!-- Begin slideshow. -->
23 <div class="slideshow-set">
24
25 <div class="slideshow-items">
26
27 <?php
28 /* Get the sticky posts. */
29 $sticky = get_option( 'sticky_posts' );
30
31 /* If more than one sticky post, use them for the slider. Else, just get the 3 latest posts. */
32 $args = ( ( !empty( $sticky ) && 1 < count( $sticky ) ) ? array( 'post__in' => $sticky ) : array( 'posts_per_page' => 5 ) );
33 ?>
34
35 <?php $loop = new WP_Query( $args ); $i = 0; ?>
36
37 <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
38
39 <?php $do_not_duplicate[] = get_the_ID(); ?>
40
41 <div class="<?php hybrid_entry_class( 'slideshow-item item item-' . ++$i ); ?>">
42
43 <?php get_the_image( array( 'meta_key' => array( 'Large' ), 'size' => 'news-slideshow-large' ) ); ?>
44
45 <?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '">', '</a></h2>', false ) ); ?>
46
47 <div class="slideshow-caption">
48 <div class="entry-summary slideshow-caption-text"><?php the_excerpt(); ?></div>
49 </div><!-- .slideshow-caption -->
50
51 </div><!-- .hentry -->
52
53 <?php endwhile; ?>
54
55 </div><!-- .slideshow-items -->
56
57 <div class="slideshow-controls">
58 <div class="slideshow-pager"></div>
59 <div class="slideshow-nav">
b67e8bf @justintadlock Change all instances of hybrid_get_textdomain() to 'news'.
authored
60 <a class="slider-prev"><?php _e( 'Previous', 'news' ); ?></a>
61 <a class="slider-next"><?php _e( 'Next', 'news' ); ?></a>
217f7fd Importing the News theme files and folders.
greenshady authored
62 </div>
63 </div><!-- .slideshow-controls -->
64
65 </div><!-- .slideshow-set -->
66 <!-- End slideshow. -->
67
68 <?php get_sidebar( 'feature' ); ?>
69
70 </div>
71 <!-- End feature area. -->
72
73 <?php do_atomic( 'before_content' ); // Before content hook ?>
74
75 <div id="content">
76
77 <?php do_atomic( 'open_content' ); // Open content hook ?>
78
79 <div class="hfeed">
80
81 <!-- Begin category highlight section. -->
82 <?php $categories = hybrid_get_setting( 'home_template_categories' ); ?>
83
84 <?php if ( !empty( $categories ) && is_array( $categories ) ) { ?>
85
86 <!-- Begin category section. -->
87 <div id="category-highlight">
88
89 <?php foreach ( $categories as $category ) { ?>
90
91 <?php $loop = new WP_Query( array( 'cat' => $category, 'posts_per_page' => 6, 'post__not_in' => $do_not_duplicate ) ); ?>
92
93 <?php if ( $loop->have_posts() ) : ?>
94
95 <div class="section category-section">
96
97 <div class="section-wrap category-section-wrap">
98
99 <?php $term = get_term( $category, 'category' ); ?>
100
101 <h2 class="category-title section-title"><a href="<?php echo get_term_link( $term, 'category' ); ?>" title="<?php echo esc_attr( $term->name ); ?>"><?php echo $term->name; ?></a></h2>
102
103 <?php $i = 0; ?>
104
105 <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
106
107 <?php $do_not_duplicate[] = get_the_ID(); ?>
108
109 <?php if ( ++$i == 1 ) { // If first post, show title, excerpt, and image. ?>
110
111 <div class="<?php hybrid_entry_class(); ?>">
112
113 <?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h3 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h3>', false ) ); ?>
114
115 <?php get_the_image( array( 'meta_key' => array( 'Thumbnail' ), 'size' => 'news-thumbnail' ) ); ?>
116
117 <div class="entry-summary">
118 <?php the_excerpt(); ?>
119 </div><!-- .entry-summary -->
120
121 </div><!-- .hentry -->
122
123 <?php } else { // If not the first post, add the entry titles as list items. ?>
124
125 <?php if ( $i == 2 ) echo '<ul class="xoxo post-list">'; // If second post, open the list. ?>
126
127 <li>
128 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
129 <?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">[entry-published] [entry-comments-link before=" // "]</div>' ); ?>
130 </li>
131
132 <?php } ?>
133
134 <?php endwhile; ?>
135
136 <?php if ( $i > 1 ) echo '</ul>'; // If there is more than one post, close the list after the loop. ?>
137
138 </div><!-- .section-wrap -->
139
140 </div><!-- .section -->
141 <!-- End category section. -->
142
143 <?php endif; ?>
144
145 <?php } ?>
146
147 </div><!-- .category-highlight -->
148
149 <?php } ?>
150 <!-- End category highlight section. -->
151
152 <!-- Begin more articles section. -->
153 <?php $loop = new WP_Query( array( 'posts_per_page' => 3, 'post__not_in' => $do_not_duplicate ) ); ?>
154
155 <?php if ( $loop->have_posts() ) : ?>
156
157 <div id="more-articles" class="section">
158
159 <div class="section-wrap">
160
b67e8bf @justintadlock Change all instances of hybrid_get_textdomain() to 'news'.
authored
161 <h2 class="section-title"><?php _e( 'More Articles', 'news' ); ?></h2>
217f7fd Importing the News theme files and folders.
greenshady authored
162
163 <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
164
165 <div class="<?php hybrid_entry_class(); ?>">
166
167 <?php get_the_image( array( 'meta_key' => array( 'Thumbnail' ), 'size' => 'news-thumbnail' ) ); ?>
168
169 <?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h3 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h3>', false ) ); ?>
170
171 <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">[entry-published] [entry-comments-link] [entry-popup-shortlink]</div>' ); ?>
172
173 <div class="entry-summary">
174 <?php the_excerpt(); ?>
175 </div><!-- .entry-summary -->
176
177 </div><!-- .hentry -->
178
179 <?php endwhile; ?>
180
181 </div><!-- .section-wrap -->
182
183 </div><!-- .section -->
184
185 <?php endif; ?>
186 <!-- End more articles section. -->
187
188 </div><!-- .hfeed -->
189
190 <?php do_atomic( 'close_content' ); // Close content hook ?>
191
192 </div><!-- #content -->
193
194 <?php do_atomic( 'after_content' ); // After content hook ?>
195
196 <?php get_footer(); ?>
Something went wrong with that request. Please try again.