Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 139 lines (101 sloc) 4.096 kb
98a8e4e @jayj updated
authored
1 <?php
2 /**
3 * Featured Content (slider) Template
4 *
3fb3ddb @jayj Inline documentation improvements
authored
5 * This template file is used for the slider on the home and blog page.
6 * Child Themes can replace it via {section-slider.php}
98a8e4e @jayj updated
authored
7 *
bda9730 @jayj PHPDoc changes. You can browse the documentation on http://wpthemes.jayj...
authored
8 * @package Cakifo
9 * @subpackage Template
98a8e4e @jayj updated
authored
10 */
11 ?>
12
13 <?php
d992345 @jayj Post title improvements + other
authored
14 /**
3fb3ddb @jayj Inline documentation improvements
authored
15 * Select posts from the selected categories
d992345 @jayj Post title improvements + other
authored
16 */
17 if ( hybrid_get_setting( 'featured_category' ) ) :
30f9e0d @jayj Code cleanup
authored
18 $feature_query = array(
0116328 @jayj Spacing clean ups
authored
19 'cat' => hybrid_get_setting( 'featured_category' ),
20 'showposts' => hybrid_get_setting( 'featured_posts' ),
d992345 @jayj Post title improvements + other
authored
21 'ignore_sticky_posts' => 1,
0116328 @jayj Spacing clean ups
authored
22 'post_status' => 'publish',
23 'no_found_rows' => true,
d992345 @jayj Post title improvements + other
authored
24 );
3fb3ddb @jayj Inline documentation improvements
authored
25 // No selected categories, use Sticky Posts
d992345 @jayj Post title improvements + other
authored
26 else :
27 $feature_query = array(
0116328 @jayj Spacing clean ups
authored
28 'post__in' => get_option( 'sticky_posts' ),
29 'showposts' => hybrid_get_setting( 'featured_posts' ),
30 'post_status' => 'publish',
4defffe @jayj Remove the reset CSS. Adds parts from the normalize.css.. Still needs mo...
authored
31 'no_found_rows' => true,
d992345 @jayj Post title improvements + other
authored
32 );
33 endif;
98a8e4e @jayj updated
authored
34 ?>
35
36 <?php $loop = new WP_Query( $feature_query ); ?>
37
38 <?php if ( $loop->have_posts() ) : ?>
39
40 <?php do_atomic( 'before_slider' ); // cakifo_before_slider ?>
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
41
10b056d @jayj HTML5 allows a h1 heading in each section (section, nav, article, aside)
authored
42 <section id="slider">
20b33e4 @jayj Print style, Slides 1.1.8 and clean up
authored
43
0116328 @jayj Spacing clean ups
authored
44 <h3 class="assistive-text"><?php _e( 'Featured Posts', 'cakifo' ); ?></h3>
98a8e4e @jayj updated
authored
45
fa7a27d @jayj First pass at the FlexSlider script
authored
46 <div class="slides-container">
98a8e4e @jayj updated
authored
47
a08cd2c @jayj Huge commit
authored
48 <?php do_atomic( 'open_slider' ); // cakifo_open_slider ?>
98a8e4e @jayj updated
authored
49
d883e39 @jayj Add space again
authored
50 <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
98a8e4e @jayj updated
authored
51
52 <?php do_atomic( 'before_slide' ); // cakifo_before_slide ?>
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
53
fa7a27d @jayj First pass at the FlexSlider script
authored
54 <article class="slide" data-thumb="">
1b4f0a5 @jayj Downgrades Slides to version 1.1.9
authored
55
98a8e4e @jayj updated
authored
56 <?php do_atomic( 'open_slide' ); // cakifo_open_slide ?>
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
57
58 <?php
a08cd2c @jayj Huge commit
authored
59 if ( current_theme_supports( 'get-the-image' ) ) :
60
61 /**
62 * Get the post thumbnail with the slider image size
63 *
64 * Either from a custom field, the featured image function,
3fb3ddb @jayj Inline documentation improvements
authored
65 * or an embed video (video post format only)
30f9e0d @jayj Code cleanup
authored
66 *
bda9730 @jayj PHPDoc changes. You can browse the documentation on http://wpthemes.jayj...
authored
67 * @var string
97f808e @jayj Pinking shears
authored
68 */
a08cd2c @jayj Huge commit
authored
69 $thumbnail = get_the_image( array(
0116328 @jayj Spacing clean ups
authored
70 'size' => 'slider',
71 'attachment' => false,
72 'meta_key' => null, // Don't allow to set thumbnail with custom field. That way you can have 2 thumbnails. One for the post and one for the slider
a08cd2c @jayj Huge commit
authored
73 'image_class' => 'thumbnail',
0116328 @jayj Spacing clean ups
authored
74 'echo' => false
cf15476 @jayj Fix invalid HTML. License and html readme added
authored
75 ) );
a08cd2c @jayj Huge commit
authored
76
77 $thumbnail_size = cakifo_get_image_size( 'slider' );
d3c8f07 @jayj Move post format functions to post-formats.php
authored
78 $video = '';
a08cd2c @jayj Huge commit
authored
79
3fb3ddb @jayj Inline documentation improvements
authored
80 // There's a thumbnail!
a08cd2c @jayj Huge commit
authored
81 if ( $thumbnail ) :
82
83 echo $thumbnail;
84
7b2628c @jayj The slider video function is now 20.000% faster! (I think - math is not ...
authored
85 /**
86 * Try to embed a video from the post content
87 */
88 elseif ( has_post_format( 'video' ) ) :
89
325881b @jayj Use the cakifo_get_video_embed() to grab a video
authored
90 $video = cakifo_get_video_embed();
7b2628c @jayj The slider video function is now 20.000% faster! (I think - math is not ...
authored
91
0149900 @jayj Update the cakifo_image_info() function to use a definition list and sep...
authored
92 // There's a video!
7b2628c @jayj The slider video function is now 20.000% faster! (I think - math is not ...
authored
93 if ( isset( $video ) ) {
e2a5a52 @jayj Update video slider code to maintain the right aspect ratio
authored
94
95 // Get the original width and height
96 preg_match('/width="(\d+)(px)?" height="(\d+)(px)?"/', $video, $matches);
97
0116328 @jayj Spacing clean ups
authored
98 $width = intval( $matches[1] );
e2a5a52 @jayj Update video slider code to maintain the right aspect ratio
authored
99 $height = intval( $matches[3] );
100
101 // Calculate the new height to maintain the right aspect ratio
0116328 @jayj Spacing clean ups
authored
102 $new_width = $thumbnail_size['width'];
e2a5a52 @jayj Update video slider code to maintain the right aspect ratio
authored
103 $new_height = intval( $new_width * $height / $width );
104
7b2628c @jayj The slider video function is now 20.000% faster! (I think - math is not ...
authored
105 // Change the width and height attributes
e2a5a52 @jayj Update video slider code to maintain the right aspect ratio
authored
106 $video = preg_replace('/width="(\d+)(px)?" height="(\d+)(px)?"/', 'width="' . $new_width . '" height="' . $new_height . '"', $video);
a08cd2c @jayj Huge commit
authored
107
7b2628c @jayj The slider video function is now 20.000% faster! (I think - math is not ...
authored
108 echo '<div class="slider-video">' . $video . '</div>';
109 }
a08cd2c @jayj Huge commit
authored
110
111 endif;
112
113 endif;
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
114 ?>
98a8e4e @jayj updated
authored
115
d3c8f07 @jayj Move post format functions to post-formats.php
authored
116 <div class="entry-summary <?php if ( ! $video && ! $thumbnail ) echo 'no-featured-image'; ?>">
98a8e4e @jayj updated
authored
117 <?php echo apply_atomic_shortcode( 'slider_entry_title', '[entry-title]' ); ?>
118 <?php the_excerpt(); ?>
d5b6def @jayj Make the Cakifo textdomain static due to changes in Hybrid Core
authored
119 <a class="more-link" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php _e( 'Continue reading <span class="meta-nav">&raquo;</span>', 'cakifo' ); ?></a>
98a8e4e @jayj updated
authored
120 </div> <!-- .entry-summary -->
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
121
98a8e4e @jayj updated
authored
122 <?php do_atomic( 'close_slide' ); // cakifo_close_slide ?>
e2d1620 @jayj Small improvements
authored
123
1b4f0a5 @jayj Downgrades Slides to version 1.1.9
authored
124 </article> <!-- .slide -->
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
125
98a8e4e @jayj updated
authored
126 <?php do_atomic( 'after_slide' ); // after_close_slide ?>
127
128 <?php endwhile; ?>
129
130 <?php do_atomic( 'close_slider' ); // cakifo_close_slider ?>
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
131
fa7a27d @jayj First pass at the FlexSlider script
authored
132 </div> <!-- .slides-container -->
1b4f0a5 @jayj Downgrades Slides to version 1.1.9
authored
133
10b056d @jayj HTML5 allows a h1 heading in each section (section, nav, article, aside)
authored
134 </section> <!-- #slider -->
98d2d96 @jayj Code cleanup, a little easter egg, updated scripts and other improvement...
authored
135
98a8e4e @jayj updated
authored
136 <?php do_atomic( 'after_slider' ); // cakifo_after_slider ?>
137
30f9e0d @jayj Code cleanup
authored
138 <?php endif; wp_reset_query(); ?>
Something went wrong with that request. Please try again.