Genesis Responsive Slider - Version 0.9.5

Version Description

  • Plugin header i18n
Download this release

Release Info

Developer nathanrice
Plugin Icon 128x128 Genesis Responsive Slider
Version 0.9.5
Comparing to
See all releases

Code changes from version 0.9.4 to 0.9.5

Files changed (3) hide show
  1. genesis-responsive-slider.php +446 -443
  2. package.json +1 -1
  3. readme.txt +80 -77
genesis-responsive-slider.php CHANGED
@@ -1,444 +1,447 @@
1
- <?php
2
- /*
3
- Plugin Name: Genesis Responsive Slider
4
- Plugin URI: http://www.studiopress.com
5
- Description: A responsive featured slider for the Genesis Framework.
6
- Author: StudioPress
7
- Author URI: http://www.studiopress.com
8
-
9
- Version: 0.9.4
10
-
11
- License: GNU General Public License v2.0 (or later)
12
- License URI: http://www.opensource.org/licenses/gpl-license.php
13
- */
14
-
15
- /**
16
- * Props to Rafal Tomal, Nick Croft, Nathan Rice, Ron Rennick, Josh Byers and Brian Gardner for collaboratively writing this plugin.
17
- */
18
-
19
- /**
20
- * Thanks to Tyler Smith for creating the awesome jquery FlexSlider plugin - http://flex.madebymufffin.com/.
21
- */
22
-
23
- define( 'GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD', 'genesis_responsive_slider_settings' );
24
- define( 'GENESIS_RESPONSIVE_SLIDER_VERSION', '0.9.2' );
25
-
26
- add_action( 'after_setup_theme', 'GenesisResponsiveSliderInit', 15 );
27
- /**
28
- * Loads required files and adds image via Genesis Init Hook
29
- */
30
- function GenesisResponsiveSliderInit() {
31
-
32
- /** require Genesis */
33
- if( ! function_exists( 'genesis_get_option' ) )
34
- return;
35
-
36
- // translation support
37
- load_plugin_textdomain( 'genesis-responsive-slider', false, '/genesis-responsive-slider/languages/' );
38
-
39
- /** hook all frontend slider functions here to ensure Genesis is active **/
40
- add_action( 'wp_enqueue_scripts', 'genesis_responsive_slider_scripts' );
41
- add_action( 'wp_print_styles', 'genesis_responsive_slider_styles' );
42
- add_action( 'wp_head', 'genesis_responsive_slider_head', 1 );
43
- add_action( 'wp_footer', 'genesis_responsive_slider_flexslider_params' );
44
- add_action( 'widgets_init', 'genesis_responsive_sliderRegister' );
45
-
46
- /** Include Admin file */
47
- if ( is_admin() ) require_once( dirname( __FILE__ ) . '/admin.php' );
48
-
49
- /** Add new image size */
50
- add_image_size( 'slider', ( int ) genesis_get_responsive_slider_option( 'slideshow_width' ), ( int ) genesis_get_responsive_slider_option( 'slideshow_height' ), TRUE );
51
-
52
- }
53
-
54
- add_action( 'genesis_settings_sanitizer_init', 'genesis_responsive_slider_sanitization' );
55
- /**
56
- * Add settings to Genesis sanitization
57
- *
58
- */
59
- function genesis_responsive_slider_sanitization() {
60
- genesis_add_option_filter( 'one_zero', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
61
- array(
62
- 'slideshow_arrows',
63
- 'slideshow_excerpt_show',
64
- 'slideshow_title_show',
65
- 'slideshow_loop',
66
- 'slideshow_hide_mobile',
67
- 'slideshow_no_link',
68
- 'slideshow_pager'
69
- ) );
70
- genesis_add_option_filter( 'no_html', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
71
- array(
72
- 'post_type',
73
- 'posts_term',
74
- 'exclude_terms',
75
- 'include_exclude',
76
- 'post_id',
77
- 'posts_num',
78
- 'posts_offset',
79
- 'orderby',
80
- 'slideshow_timer',
81
- 'slideshow_delay',
82
- 'slideshow_height',
83
- 'slideshow_width',
84
- 'slideshow_effect',
85
- 'slideshow_excerpt_content',
86
- 'slideshow_excerpt_content_limit',
87
- 'slideshow_more_text',
88
- 'slideshow_excerpt_width',
89
- 'location_vertical',
90
- 'location_horizontal',
91
- ) );
92
- }
93
-
94
- /**
95
- * Load the script files
96
- */
97
- function genesis_responsive_slider_scripts() {
98
-
99
- /** easySlider JavaScript code */
100
- wp_enqueue_script( 'flexslider', plugins_url('js/jquery.flexslider.js', __FILE__), array( 'jquery' ), GENESIS_RESPONSIVE_SLIDER_VERSION, TRUE );
101
-
102
- }
103
-
104
- /**
105
- * Load the CSS files
106
- */
107
- function genesis_responsive_slider_styles() {
108
-
109
- /** standard slideshow styles */
110
- wp_register_style( 'slider_styles', plugins_url('style.css', __FILE__), array(), GENESIS_RESPONSIVE_SLIDER_VERSION );
111
- wp_enqueue_style( 'slider_styles' );
112
-
113
- }
114
-
115
- /**
116
- * Loads scripts and styles via wp_head hook.
117
- */
118
- function genesis_responsive_slider_head() {
119
-
120
- $height = ( int ) genesis_get_responsive_slider_option( 'slideshow_height' );
121
- $width = ( int ) genesis_get_responsive_slider_option( 'slideshow_width' );
122
-
123
- $slideInfoWidth = ( int ) genesis_get_responsive_slider_option( 'slideshow_excerpt_width' );
124
- $slideNavTop = ( int ) ( ($height - 60) * .5 );
125
-
126
- $vertical = genesis_get_responsive_slider_option( 'location_vertical' );
127
- $horizontal = genesis_get_responsive_slider_option( 'location_horizontal' );
128
- $display = ( genesis_get_responsive_slider_option( 'posts_num' ) >= 2 && genesis_get_responsive_slider_option( 'slideshow_arrows' ) ) ? 'top: ' . $slideNavTop . 'px' : 'display: none';
129
-
130
- $hide_mobile = genesis_get_responsive_slider_option( 'slideshow_hide_mobile' );
131
- $slideshow_pager = genesis_get_responsive_slider_option( 'slideshow_pager' );
132
-
133
- echo '
134
- <style type="text/css">
135
- .slide-excerpt { width: ' . $slideInfoWidth . '%; }
136
- .slide-excerpt { ' . $vertical . ': 0; }
137
- .slide-excerpt { '. $horizontal . ': 0; }
138
- .flexslider { max-width: ' . $width . 'px; max-height: ' . $height . 'px; }
139
- .slide-image { max-height: ' . $height . 'px; }
140
- </style>';
141
-
142
- if ( $hide_mobile == 1 ) {
143
- echo '
144
- <style type="text/css">
145
- @media only screen
146
- and (min-device-width : 320px)
147
- and (max-device-width : 480px) {
148
- .slide-excerpt { display: none !important; }
149
- }
150
- </style> ';
151
- }
152
- }
153
-
154
- /**
155
- * Outputs slider script on wp_footer hook.
156
- */
157
- function genesis_responsive_slider_flexslider_params() {
158
-
159
- $timer = ( int ) genesis_get_responsive_slider_option( 'slideshow_timer' );
160
- $duration = ( int ) genesis_get_responsive_slider_option( 'slideshow_delay' );
161
- $effect = genesis_get_responsive_slider_option( 'slideshow_effect' );
162
- $controlnav = genesis_get_responsive_slider_option( 'slideshow_pager' );
163
- $directionnav = genesis_get_responsive_slider_option( 'slideshow_arrows' );
164
-
165
- $output = 'jQuery(document).ready(function($) {
166
- $(".flexslider").flexslider({
167
- controlsContainer: "#genesis-responsive-slider",
168
- animation: "' . esc_js( $effect ) . '",
169
- directionNav: ' . $directionnav . ',
170
- controlNav: ' . $controlnav . ',
171
- animationDuration: ' . $duration . ',
172
- slideshowSpeed: ' . $timer . '
173
- });
174
- });';
175
-
176
- $output = str_replace( array( "\n", "\t", "\r" ), '', $output );
177
-
178
- echo '<script type=\'text/javascript\'>' . $output . '</script>';
179
- }
180
-
181
- /**
182
- * Registers the slider widget
183
- */
184
- function genesis_responsive_sliderRegister() {
185
- register_widget( 'genesis_responsive_sliderWidget' );
186
- }
187
-
188
- /** Creates read more link after excerpt */
189
- function genesis_responsive_slider_excerpt_more( $more ) {
190
- global $post;
191
- static $read_more = null;
192
-
193
- if ( $read_more === null )
194
- $read_more = genesis_get_responsive_slider_option( 'slideshow_more_text' );
195
-
196
- if ( !$read_more )
197
- return '';
198
-
199
- return '&hellip; <a href="'. get_permalink( $post->ID ) . '">' . __( $read_more, 'genesis-responsive-slider' ) . '</a>';
200
- }
201
-
202
- /**
203
- * Slideshow Widget Class
204
- */
205
- class genesis_responsive_sliderWidget extends WP_Widget {
206
-
207
- function __construct() {
208
- $widget_ops = array( 'classname' => 'genesis_responsive_slider', 'description' => __( 'Displays a slideshow inside a widget area', 'genesis-responsive-slider' ) );
209
- $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'genesisresponsiveslider-widget' );
210
- parent::__construct( 'genesisresponsiveslider-widget', __( 'Genesis - Responsive Slider', 'genesis-responsive-slider' ), $widget_ops, $control_ops );
211
- }
212
-
213
- function save_settings( $settings ) {
214
- $settings['_multiwidget'] = 0;
215
- update_option( $this->option_name, $settings );
216
- }
217
-
218
- // display widget
219
- function widget( $args, $instance ) {
220
- extract( $args );
221
-
222
- echo $before_widget;
223
-
224
- $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
225
- if ( $title )
226
- echo $before_title . $title . $after_title;
227
-
228
- $term_args = array( );
229
-
230
- if ( 'page' != genesis_get_responsive_slider_option( 'post_type' ) ) {
231
-
232
- if ( genesis_get_responsive_slider_option( 'posts_term' ) ) {
233
-
234
- $posts_term = explode( ',', genesis_get_responsive_slider_option( 'posts_term' ) );
235
-
236
- if ( 'category' == $posts_term['0'] )
237
- $posts_term['0'] = 'category_name';
238
-
239
- if ( 'post_tag' == $posts_term['0'] )
240
- $posts_term['0'] = 'tag';
241
-
242
- if ( isset( $posts_term['1'] ) )
243
- $term_args[$posts_term['0']] = $posts_term['1'];
244
-
245
- }
246
-
247
- if ( !empty( $posts_term['0'] ) ) {
248
-
249
- if ( 'category' == $posts_term['0'] )
250
- $taxonomy = 'category';
251
-
252
- elseif ( 'post_tag' == $posts_term['0'] )
253
- $taxonomy = 'post_tag';
254
-
255
- else
256
- $taxonomy = $posts_term['0'];
257
-
258
- } else {
259
-
260
- $taxonomy = 'category';
261
-
262
- }
263
-
264
- if ( genesis_get_responsive_slider_option( 'exclude_terms' ) ) {
265
-
266
- $exclude_terms = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'exclude_terms' ) ) );
267
- $term_args[$taxonomy . '__not_in'] = $exclude_terms;
268
-
269
- }
270
- }
271
-
272
- if ( genesis_get_responsive_slider_option( 'posts_offset' ) ) {
273
- $myOffset = genesis_get_responsive_slider_option( 'posts_offset' );
274
- $term_args['offset'] = $myOffset;
275
- }
276
-
277
- if ( genesis_get_responsive_slider_option( 'post_id' ) ) {
278
- $IDs = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'post_id' ) ) );
279
- if ( 'include' == genesis_get_responsive_slider_option( 'include_exclude' ) )
280
- $term_args['post__in'] = $IDs;
281
- else
282
- $term_args['post__not_in'] = $IDs;
283
- }
284
-
285
- $query_args = array_merge( $term_args, array(
286
- 'post_type' => genesis_get_responsive_slider_option( 'post_type' ),
287
- 'posts_per_page' => genesis_get_responsive_slider_option( 'posts_num' ),
288
- 'orderby' => genesis_get_responsive_slider_option( 'orderby' ),
289
- 'order' => genesis_get_responsive_slider_option( 'order' ),
290
- 'meta_key' => genesis_get_responsive_slider_option( 'meta_key' )
291
- ) );
292
-
293
- $query_args = apply_filters( 'genesis_responsive_slider_query_args', $query_args );
294
- add_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
295
-
296
- ?>
297
-
298
- <div id="genesis-responsive-slider">
299
- <div class="flexslider">
300
- <ul class="slides">
301
- <?php
302
- $slider_posts = new WP_Query( $query_args );
303
- if ( $slider_posts->have_posts() ) {
304
- $show_excerpt = genesis_get_responsive_slider_option( 'slideshow_excerpt_show' );
305
- $show_title = genesis_get_responsive_slider_option( 'slideshow_title_show' );
306
- $show_type = genesis_get_responsive_slider_option( 'slideshow_excerpt_content' );
307
- $show_limit = genesis_get_responsive_slider_option( 'slideshow_excerpt_content_limit' );
308
- $more_text = genesis_get_responsive_slider_option( 'slideshow_more_text' );
309
- $no_image_link = genesis_get_responsive_slider_option( 'slideshow_no_link' );
310
- }
311
- while ( $slider_posts->have_posts() ) : $slider_posts->the_post();
312
- ?>
313
- <li>
314
-
315
- <?php if ( $show_excerpt == 1 || $show_title == 1 ) { ?>
316
- <div class="slide-excerpt slide-<?php the_ID(); ?>">
317
- <div class="slide-background"></div><!-- end .slide-background -->
318
- <div class="slide-excerpt-border ">
319
- <?php
320
- if ( $show_title == 1 ) {
321
- ?>
322
- <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
323
- <?php
324
- }
325
- if ( $show_excerpt ) {
326
- if ( $show_type != 'full' )
327
- the_excerpt();
328
- elseif ( $show_limit )
329
- the_content_limit( (int)$show_limit, esc_html( $more_text ) );
330
- else
331
- the_content( esc_html( $more_text ) );
332
- }
333
- ?>
334
- </div><!-- end .slide-excerpt-border -->
335
- </div><!-- end .slide-excerpt -->
336
- <?php } ?>
337
-
338
- <div class="slide-image">
339
- <?php
340
- if ( $no_image_link ) {
341
- ?>
342
- <img src="<?php genesis_image( 'format=url&size=slider' ); ?>" alt="<?php the_title(); ?>" />
343
- <?php
344
- } else {
345
- ?>
346
- <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php genesis_image( 'format=url&size=slider' ); ?>" alt="<?php the_title(); ?>" /></a>
347
- <?php
348
-
349
- } // $no_image_link
350
- ?>
351
- </div><!-- end .slide-image -->
352
-
353
- </li>
354
- <?php endwhile; ?>
355
- </ul><!-- end ul.slides -->
356
- </div><!-- end .flexslider -->
357
- </div><!-- end #genesis-responsive-slider -->
358
-
359
- <?php
360
- echo $after_widget;
361
- wp_reset_query();
362
- remove_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
363
-
364
- }
365
-
366
- /** Widget options */
367
- function form( $instance ) {
368
- $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
369
- $title = $instance['title'];
370
- ?>
371
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'genesis-responsive-slider' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
372
- <?php
373
- echo '<p>';
374
- printf( __( 'To configure slider options, please go to the <a href="%s">Slider Settings</a> page.', 'genesis-responsive-slider' ), menu_page_url( 'genesis_responsive_slider', 0 ) );
375
- echo '</p>';
376
- }
377
-
378
- function update( $new_instance, $old_instance ) {
379
- $instance = $old_instance;
380
- $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
381
- $instance['title'] = strip_tags( $new_instance['title'] );
382
- return $instance;
383
- }
384
-
385
- }
386
-
387
- /**
388
- * Used to exclude taxonomies and related terms from list of available terms/taxonomies in widget form().
389
- *
390
- * @since 0.9
391
- * @author Nick Croft
392
- *
393
- * @param string $taxonomy 'taxonomy' being tested
394
- * @return string
395
- */
396
- function genesis_responsive_slider_exclude_taxonomies( $taxonomy ) {
397
-
398
- $filters = array( '', 'nav_menu' );
399
- $filters = apply_filters( 'genesis_responsive_slider_exclude_taxonomies', $filters );
400
-
401
- return ( ! in_array( $taxonomy->name, $filters ) );
402
-
403
- }
404
-
405
- /**
406
- * Used to exclude post types from list of available post_types in widget form().
407
- *
408
- * @since 0.9
409
- * @author Nick Croft
410
- *
411
- * @param string $type 'post_type' being tested
412
- * @return string
413
- */
414
- function genesis_responsive_slider_exclude_post_types( $type ) {
415
-
416
- $filters = array( '', 'attachment' );
417
- $filters = apply_filters( 'genesis_responsive_slider_exclude_post_types', $filters );
418
-
419
- return ( ! in_array( $type, $filters ) );
420
-
421
- }
422
-
423
- /**
424
- * Returns Slider Option
425
- *
426
- * @param string $key key value for option
427
- * @return string
428
- */
429
- function genesis_get_responsive_slider_option( $key ) {
430
- return genesis_get_option( $key, GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD );
431
- }
432
-
433
- /**
434
- * Echos Slider Option
435
- *
436
- * @param string $key key value for option
437
- */
438
- function genesis_responsive_slider_option( $key ) {
439
-
440
- if ( ! genesis_get_responsive_slider_option( $key ) )
441
- return false;
442
-
443
- echo genesis_get_responsive_slider_option( $key );
 
 
 
444
  }
1
+ <?php
2
+ /*
3
+ Plugin Name: Genesis Responsive Slider
4
+ Plugin URI: http://www.studiopress.com
5
+ Description: A responsive featured slider for the Genesis Framework.
6
+ Author: StudioPress
7
+ Author URI: http://www.studiopress.com
8
+
9
+ Version: 0.9.5
10
+
11
+ Text Domain: genesis-responsive-slider
12
+ Domain Path: /languages
13
+
14
+ License: GNU General Public License v2.0 (or later)
15
+ License URI: http://www.opensource.org/licenses/gpl-license.php
16
+ */
17
+
18
+ /**
19
+ * Props to Rafal Tomal, Nick Croft, Nathan Rice, Ron Rennick, Josh Byers and Brian Gardner for collaboratively writing this plugin.
20
+ */
21
+
22
+ /**
23
+ * Thanks to Tyler Smith for creating the awesome jquery FlexSlider plugin - http://flex.madebymufffin.com/.
24
+ */
25
+
26
+ define( 'GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD', 'genesis_responsive_slider_settings' );
27
+ define( 'GENESIS_RESPONSIVE_SLIDER_VERSION', '0.9.5' );
28
+
29
+ add_action( 'after_setup_theme', 'GenesisResponsiveSliderInit', 15 );
30
+ /**
31
+ * Loads required files and adds image via Genesis Init Hook
32
+ */
33
+ function GenesisResponsiveSliderInit() {
34
+
35
+ /** require Genesis */
36
+ if( ! function_exists( 'genesis_get_option' ) )
37
+ return;
38
+
39
+ // translation support
40
+ load_plugin_textdomain( 'genesis-responsive-slider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
41
+
42
+ /** hook all frontend slider functions here to ensure Genesis is active **/
43
+ add_action( 'wp_enqueue_scripts', 'genesis_responsive_slider_scripts' );
44
+ add_action( 'wp_print_styles', 'genesis_responsive_slider_styles' );
45
+ add_action( 'wp_head', 'genesis_responsive_slider_head', 1 );
46
+ add_action( 'wp_footer', 'genesis_responsive_slider_flexslider_params' );
47
+ add_action( 'widgets_init', 'genesis_responsive_sliderRegister' );
48
+
49
+ /** Include Admin file */
50
+ if ( is_admin() ) require_once( dirname( __FILE__ ) . '/admin.php' );
51
+
52
+ /** Add new image size */
53
+ add_image_size( 'slider', ( int ) genesis_get_responsive_slider_option( 'slideshow_width' ), ( int ) genesis_get_responsive_slider_option( 'slideshow_height' ), TRUE );
54
+
55
+ }
56
+
57
+ add_action( 'genesis_settings_sanitizer_init', 'genesis_responsive_slider_sanitization' );
58
+ /**
59
+ * Add settings to Genesis sanitization
60
+ *
61
+ */
62
+ function genesis_responsive_slider_sanitization() {
63
+ genesis_add_option_filter( 'one_zero', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
64
+ array(
65
+ 'slideshow_arrows',
66
+ 'slideshow_excerpt_show',
67
+ 'slideshow_title_show',
68
+ 'slideshow_loop',
69
+ 'slideshow_hide_mobile',
70
+ 'slideshow_no_link',
71
+ 'slideshow_pager'
72
+ ) );
73
+ genesis_add_option_filter( 'no_html', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
74
+ array(
75
+ 'post_type',
76
+ 'posts_term',
77
+ 'exclude_terms',
78
+ 'include_exclude',
79
+ 'post_id',
80
+ 'posts_num',
81
+ 'posts_offset',
82
+ 'orderby',
83
+ 'slideshow_timer',
84
+ 'slideshow_delay',
85
+ 'slideshow_height',
86
+ 'slideshow_width',
87
+ 'slideshow_effect',
88
+ 'slideshow_excerpt_content',
89
+ 'slideshow_excerpt_content_limit',
90
+ 'slideshow_more_text',
91
+ 'slideshow_excerpt_width',
92
+ 'location_vertical',
93
+ 'location_horizontal',
94
+ ) );
95
+ }
96
+
97
+ /**
98
+ * Load the script files
99
+ */
100
+ function genesis_responsive_slider_scripts() {
101
+
102
+ /** easySlider JavaScript code */
103
+ wp_enqueue_script( 'flexslider', plugins_url('js/jquery.flexslider.js', __FILE__), array( 'jquery' ), GENESIS_RESPONSIVE_SLIDER_VERSION, TRUE );
104
+
105
+ }
106
+
107
+ /**
108
+ * Load the CSS files
109
+ */
110
+ function genesis_responsive_slider_styles() {
111
+
112
+ /** standard slideshow styles */
113
+ wp_register_style( 'slider_styles', plugins_url('style.css', __FILE__), array(), GENESIS_RESPONSIVE_SLIDER_VERSION );
114
+ wp_enqueue_style( 'slider_styles' );
115
+
116
+ }
117
+
118
+ /**
119
+ * Loads scripts and styles via wp_head hook.
120
+ */
121
+ function genesis_responsive_slider_head() {
122
+
123
+ $height = ( int ) genesis_get_responsive_slider_option( 'slideshow_height' );
124
+ $width = ( int ) genesis_get_responsive_slider_option( 'slideshow_width' );
125
+
126
+ $slideInfoWidth = ( int ) genesis_get_responsive_slider_option( 'slideshow_excerpt_width' );
127
+ $slideNavTop = ( int ) ( ($height - 60) * .5 );
128
+
129
+ $vertical = genesis_get_responsive_slider_option( 'location_vertical' );
130
+ $horizontal = genesis_get_responsive_slider_option( 'location_horizontal' );
131
+ $display = ( genesis_get_responsive_slider_option( 'posts_num' ) >= 2 && genesis_get_responsive_slider_option( 'slideshow_arrows' ) ) ? 'top: ' . $slideNavTop . 'px' : 'display: none';
132
+
133
+ $hide_mobile = genesis_get_responsive_slider_option( 'slideshow_hide_mobile' );
134
+ $slideshow_pager = genesis_get_responsive_slider_option( 'slideshow_pager' );
135
+
136
+ echo '
137
+ <style type="text/css">
138
+ .slide-excerpt { width: ' . $slideInfoWidth . '%; }
139
+ .slide-excerpt { ' . $vertical . ': 0; }
140
+ .slide-excerpt { '. $horizontal . ': 0; }
141
+ .flexslider { max-width: ' . $width . 'px; max-height: ' . $height . 'px; }
142
+ .slide-image { max-height: ' . $height . 'px; }
143
+ </style>';
144
+
145
+ if ( $hide_mobile == 1 ) {
146
+ echo '
147
+ <style type="text/css">
148
+ @media only screen
149
+ and (min-device-width : 320px)
150
+ and (max-device-width : 480px) {
151
+ .slide-excerpt { display: none !important; }
152
+ }
153
+ </style> ';
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Outputs slider script on wp_footer hook.
159
+ */
160
+ function genesis_responsive_slider_flexslider_params() {
161
+
162
+ $timer = ( int ) genesis_get_responsive_slider_option( 'slideshow_timer' );
163
+ $duration = ( int ) genesis_get_responsive_slider_option( 'slideshow_delay' );
164
+ $effect = genesis_get_responsive_slider_option( 'slideshow_effect' );
165
+ $controlnav = genesis_get_responsive_slider_option( 'slideshow_pager' );
166
+ $directionnav = genesis_get_responsive_slider_option( 'slideshow_arrows' );
167
+
168
+ $output = 'jQuery(document).ready(function($) {
169
+ $(".flexslider").flexslider({
170
+ controlsContainer: "#genesis-responsive-slider",
171
+ animation: "' . esc_js( $effect ) . '",
172
+ directionNav: ' . $directionnav . ',
173
+ controlNav: ' . $controlnav . ',
174
+ animationDuration: ' . $duration . ',
175
+ slideshowSpeed: ' . $timer . '
176
+ });
177
+ });';
178
+
179
+ $output = str_replace( array( "\n", "\t", "\r" ), '', $output );
180
+
181
+ echo '<script type=\'text/javascript\'>' . $output . '</script>';
182
+ }
183
+
184
+ /**
185
+ * Registers the slider widget
186
+ */
187
+ function genesis_responsive_sliderRegister() {
188
+ register_widget( 'genesis_responsive_sliderWidget' );
189
+ }
190
+
191
+ /** Creates read more link after excerpt */
192
+ function genesis_responsive_slider_excerpt_more( $more ) {
193
+ global $post;
194
+ static $read_more = null;
195
+
196
+ if ( $read_more === null )
197
+ $read_more = genesis_get_responsive_slider_option( 'slideshow_more_text' );
198
+
199
+ if ( !$read_more )
200
+ return '';
201
+
202
+ return '&hellip; <a href="'. get_permalink( $post->ID ) . '">' . __( $read_more, 'genesis-responsive-slider' ) . '</a>';
203
+ }
204
+
205
+ /**
206
+ * Slideshow Widget Class
207
+ */
208
+ class genesis_responsive_sliderWidget extends WP_Widget {
209
+
210
+ function __construct() {
211
+ $widget_ops = array( 'classname' => 'genesis_responsive_slider', 'description' => __( 'Displays a slideshow inside a widget area', 'genesis-responsive-slider' ) );
212
+ $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'genesisresponsiveslider-widget' );
213
+ parent::__construct( 'genesisresponsiveslider-widget', __( 'Genesis - Responsive Slider', 'genesis-responsive-slider' ), $widget_ops, $control_ops );
214
+ }
215
+
216
+ function save_settings( $settings ) {
217
+ $settings['_multiwidget'] = 0;
218
+ update_option( $this->option_name, $settings );
219
+ }
220
+
221
+ // display widget
222
+ function widget( $args, $instance ) {
223
+ extract( $args );
224
+
225
+ echo $before_widget;
226
+
227
+ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
228
+ if ( $title )
229
+ echo $before_title . $title . $after_title;
230
+
231
+ $term_args = array( );
232
+
233
+ if ( 'page' != genesis_get_responsive_slider_option( 'post_type' ) ) {
234
+
235
+ if ( genesis_get_responsive_slider_option( 'posts_term' ) ) {
236
+
237
+ $posts_term = explode( ',', genesis_get_responsive_slider_option( 'posts_term' ) );
238
+
239
+ if ( 'category' == $posts_term['0'] )
240
+ $posts_term['0'] = 'category_name';
241
+
242
+ if ( 'post_tag' == $posts_term['0'] )
243
+ $posts_term['0'] = 'tag';
244
+
245
+ if ( isset( $posts_term['1'] ) )
246
+ $term_args[$posts_term['0']] = $posts_term['1'];
247
+
248
+ }
249
+
250
+ if ( !empty( $posts_term['0'] ) ) {
251
+
252
+ if ( 'category' == $posts_term['0'] )
253
+ $taxonomy = 'category';
254
+
255
+ elseif ( 'post_tag' == $posts_term['0'] )
256
+ $taxonomy = 'post_tag';
257
+
258
+ else
259
+ $taxonomy = $posts_term['0'];
260
+
261
+ } else {
262
+
263
+ $taxonomy = 'category';
264
+
265
+ }
266
+
267
+ if ( genesis_get_responsive_slider_option( 'exclude_terms' ) ) {
268
+
269
+ $exclude_terms = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'exclude_terms' ) ) );
270
+ $term_args[$taxonomy . '__not_in'] = $exclude_terms;
271
+
272
+ }
273
+ }
274
+
275
+ if ( genesis_get_responsive_slider_option( 'posts_offset' ) ) {
276
+ $myOffset = genesis_get_responsive_slider_option( 'posts_offset' );
277
+ $term_args['offset'] = $myOffset;
278
+ }
279
+
280
+ if ( genesis_get_responsive_slider_option( 'post_id' ) ) {
281
+ $IDs = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'post_id' ) ) );
282
+ if ( 'include' == genesis_get_responsive_slider_option( 'include_exclude' ) )
283
+ $term_args['post__in'] = $IDs;
284
+ else
285
+ $term_args['post__not_in'] = $IDs;
286
+ }
287
+
288
+ $query_args = array_merge( $term_args, array(
289
+ 'post_type' => genesis_get_responsive_slider_option( 'post_type' ),
290
+ 'posts_per_page' => genesis_get_responsive_slider_option( 'posts_num' ),
291
+ 'orderby' => genesis_get_responsive_slider_option( 'orderby' ),
292
+ 'order' => genesis_get_responsive_slider_option( 'order' ),
293
+ 'meta_key' => genesis_get_responsive_slider_option( 'meta_key' )
294
+ ) );
295
+
296
+ $query_args = apply_filters( 'genesis_responsive_slider_query_args', $query_args );
297
+ add_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
298
+
299
+ ?>
300
+
301
+ <div id="genesis-responsive-slider">
302
+ <div class="flexslider">
303
+ <ul class="slides">
304
+ <?php
305
+ $slider_posts = new WP_Query( $query_args );
306
+ if ( $slider_posts->have_posts() ) {
307
+ $show_excerpt = genesis_get_responsive_slider_option( 'slideshow_excerpt_show' );
308
+ $show_title = genesis_get_responsive_slider_option( 'slideshow_title_show' );
309
+ $show_type = genesis_get_responsive_slider_option( 'slideshow_excerpt_content' );
310
+ $show_limit = genesis_get_responsive_slider_option( 'slideshow_excerpt_content_limit' );
311
+ $more_text = genesis_get_responsive_slider_option( 'slideshow_more_text' );
312
+ $no_image_link = genesis_get_responsive_slider_option( 'slideshow_no_link' );
313
+ }
314
+ while ( $slider_posts->have_posts() ) : $slider_posts->the_post();
315
+ ?>
316
+ <li>
317
+
318
+ <?php if ( $show_excerpt == 1 || $show_title == 1 ) { ?>
319
+ <div class="slide-excerpt slide-<?php the_ID(); ?>">
320
+ <div class="slide-background"></div><!-- end .slide-background -->
321
+ <div class="slide-excerpt-border ">
322
+ <?php
323
+ if ( $show_title == 1 ) {
324
+ ?>
325
+ <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
326
+ <?php
327
+ }
328
+ if ( $show_excerpt ) {
329
+ if ( $show_type != 'full' )
330
+ the_excerpt();
331
+ elseif ( $show_limit )
332
+ the_content_limit( (int)$show_limit, esc_html( $more_text ) );
333
+ else
334
+ the_content( esc_html( $more_text ) );
335
+ }
336
+ ?>
337
+ </div><!-- end .slide-excerpt-border -->
338
+ </div><!-- end .slide-excerpt -->
339
+ <?php } ?>
340
+
341
+ <div class="slide-image">
342
+ <?php
343
+ if ( $no_image_link ) {
344
+ ?>
345
+ <img src="<?php genesis_image( 'format=url&size=slider' ); ?>" alt="<?php the_title(); ?>" />
346
+ <?php
347
+ } else {
348
+ ?>
349
+ <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php genesis_image( 'format=url&size=slider' ); ?>" alt="<?php the_title(); ?>" /></a>
350
+ <?php
351
+
352
+ } // $no_image_link
353
+ ?>
354
+ </div><!-- end .slide-image -->
355
+
356
+ </li>
357
+ <?php endwhile; ?>
358
+ </ul><!-- end ul.slides -->
359
+ </div><!-- end .flexslider -->
360
+ </div><!-- end #genesis-responsive-slider -->
361
+
362
+ <?php
363
+ echo $after_widget;
364
+ wp_reset_query();
365
+ remove_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
366
+
367
+ }
368
+
369
+ /** Widget options */
370
+ function form( $instance ) {
371
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
372
+ $title = $instance['title'];
373
+ ?>
374
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'genesis-responsive-slider' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
375
+ <?php
376
+ echo '<p>';
377
+ printf( __( 'To configure slider options, please go to the <a href="%s">Slider Settings</a> page.', 'genesis-responsive-slider' ), menu_page_url( 'genesis_responsive_slider', 0 ) );
378
+ echo '</p>';
379
+ }
380
+
381
+ function update( $new_instance, $old_instance ) {
382
+ $instance = $old_instance;
383
+ $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
384
+ $instance['title'] = strip_tags( $new_instance['title'] );
385
+ return $instance;
386
+ }
387
+
388
+ }
389
+
390
+ /**
391
+ * Used to exclude taxonomies and related terms from list of available terms/taxonomies in widget form().
392
+ *
393
+ * @since 0.9
394
+ * @author Nick Croft
395
+ *
396
+ * @param string $taxonomy 'taxonomy' being tested
397
+ * @return string
398
+ */
399
+ function genesis_responsive_slider_exclude_taxonomies( $taxonomy ) {
400
+
401
+ $filters = array( '', 'nav_menu' );
402
+ $filters = apply_filters( 'genesis_responsive_slider_exclude_taxonomies', $filters );
403
+
404
+ return ( ! in_array( $taxonomy->name, $filters ) );
405
+
406
+ }
407
+
408
+ /**
409
+ * Used to exclude post types from list of available post_types in widget form().
410
+ *
411
+ * @since 0.9
412
+ * @author Nick Croft
413
+ *
414
+ * @param string $type 'post_type' being tested
415
+ * @return string
416
+ */
417
+ function genesis_responsive_slider_exclude_post_types( $type ) {
418
+
419
+ $filters = array( '', 'attachment' );
420
+ $filters = apply_filters( 'genesis_responsive_slider_exclude_post_types', $filters );
421
+
422
+ return ( ! in_array( $type, $filters ) );
423
+
424
+ }
425
+
426
+ /**
427
+ * Returns Slider Option
428
+ *
429
+ * @param string $key key value for option
430
+ * @return string
431
+ */
432
+ function genesis_get_responsive_slider_option( $key ) {
433
+ return genesis_get_option( $key, GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD );
434
+ }
435
+
436
+ /**
437
+ * Echos Slider Option
438
+ *
439
+ * @param string $key key value for option
440
+ */
441
+ function genesis_responsive_slider_option( $key ) {
442
+
443
+ if ( ! genesis_get_responsive_slider_option( $key ) )
444
+ return false;
445
+
446
+ echo genesis_get_responsive_slider_option( $key );
447
  }
package.json CHANGED
@@ -29,7 +29,7 @@
29
  "description": "A responsive featured slider for the Genesis Framework.",
30
  "author": "StudioPress",
31
  "authoruri": "http://www.studiopress.com/",
32
- "version": "0.9.4",
33
  "license": "GPL-2.0+",
34
  "licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html",
35
  "textdomain": "genesis-simple-share"
29
  "description": "A responsive featured slider for the Genesis Framework.",
30
  "author": "StudioPress",
31
  "authoruri": "http://www.studiopress.com/",
32
+ "version": "0.9.5",
33
  "license": "GPL-2.0+",
34
  "licenseuri": "http://www.gnu.org/licenses/gpl-2.0.html",
35
  "textdomain": "genesis-simple-share"
readme.txt CHANGED
@@ -1,84 +1,87 @@
1
- === Genesis Responsive Slider ===
2
- Contributors: nathanrice, studiopress, wpmuguru
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
- Tags: slider, slideshow, responsive, genesis, genesiswp, studiopress
5
- Requires at least: 3.2
6
- Tested up to: 4.3.1
7
- Stable tag: 0.9.4
8
-
9
- This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
10
-
11
- == Description ==
12
-
13
- This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
14
-
15
- It includes options for the maximum dimensions of your slideshow, allows you to choose to display posts or pages, what category to pull from, and even the specific post IDs of the posts you want to display. It includes next/previous arrows and a pager along with the option to turn both on or off. Finally, you can place the slider into a widget area.
16
-
17
- The slideshow is also responsive and will automatically adjust for the screen it is being displayed on.
18
-
19
- Note: This plugin only supports Genesis child themes.
20
-
21
- == Installation ==
22
-
23
- 1. Upload the entire `genesis-responsive-slider` folder to the `/wp-content/plugins/` directory
24
- 1. DO NOT change the name of the `genesis-responsive-slider` folder
25
- 1. Activate the plugin through the 'Plugins' menu in WordPress
26
- 1. Navigate to the `Genesis > Slider Settings` menu
27
- 1. Configure the slider
28
- 1. In the "Widgets" screen, drag the "Genesis Responsive Slider" widget to the widget area of your choice
29
-
30
- == Child Theme Integration ==
31
-
32
- To adjust the slider defaults for a child theme use a filter simiar to the following:
33
-
34
- `add_filter( 'genesis_responsive_slider_settings_defaults', 'my_child_theme_responsive_slider_defaults' );
35
-
36
- function my_child_theme_responsive_slider_defaults( $defaults ) {
37
- $defaults = array(
38
- 'post_type' => 'post',
39
- 'posts_term' => '',
40
- 'exclude_terms' => '',
41
- 'include_exclude' => '',
42
- 'post_id' => '',
43
- 'posts_num' => 5,
44
- 'posts_offset' => 0,
45
- 'orderby' => 'date',
46
- 'slideshow_timer' => 4000,
47
- 'slideshow_delay' => 800,
48
- 'slideshow_arrows' => 1,
49
- 'slideshow_pager' => 1,
50
- 'slideshow_loop' => 1,
51
- 'slideshow_height' => 400,
52
- 'slideshow_width' => 920,
53
- 'slideshow_effect' => 'slide',
54
- 'slideshow_excerpt_content' => 'excerpts',
55
- 'slideshow_excerpt_content_limit' => 150,
56
- 'slideshow_more_text' => '[Continue Reading]',
57
- 'slideshow_excerpt_show' => 1,
58
- 'slideshow_excerpt_width' => 50,
59
- 'location_vertical' => 'bottom',
60
- 'location_horizontal' => 'right',
61
- 'slideshow_hide_mobile' => 1
62
- );
63
- return $defaults;
64
- }
65
- `
66
-
67
- == Changelog ==
 
 
 
68
 
69
  = 0.9.4 =
70
  * Update POT file.
71
 
72
- = 0.9.2 =
73
- * add alt attribute to images for validation
74
  * Fix image links
75
 
76
- = 0.9.1 =
77
- * Fix slider HTML markup for validation
78
- * Fix SSL mixed cotent warning
79
- * Add setting to turn off image links
80
- * Fix Excerpt More filter to only apply to slides
81
  * UI text changes
82
-
83
- = 0.9.0 =
84
- * Beta Release
1
+ === Genesis Responsive Slider ===
2
+ Contributors: nathanrice, studiopress, wpmuguru
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
+ Tags: slider, slideshow, responsive, genesis, genesiswp, studiopress
5
+ Requires at least: 3.2
6
+ Tested up to: 4.3.1
7
+ Stable tag: 0.9.5
8
+
9
+ This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
10
+
11
+ == Description ==
12
+
13
+ This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
14
+
15
+ It includes options for the maximum dimensions of your slideshow, allows you to choose to display posts or pages, what category to pull from, and even the specific post IDs of the posts you want to display. It includes next/previous arrows and a pager along with the option to turn both on or off. Finally, you can place the slider into a widget area.
16
+
17
+ The slideshow is also responsive and will automatically adjust for the screen it is being displayed on.
18
+
19
+ Note: This plugin only supports Genesis child themes.
20
+
21
+ == Installation ==
22
+
23
+ 1. Upload the entire `genesis-responsive-slider` folder to the `/wp-content/plugins/` directory
24
+ 1. DO NOT change the name of the `genesis-responsive-slider` folder
25
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
26
+ 1. Navigate to the `Genesis > Slider Settings` menu
27
+ 1. Configure the slider
28
+ 1. In the "Widgets" screen, drag the "Genesis Responsive Slider" widget to the widget area of your choice
29
+
30
+ == Child Theme Integration ==
31
+
32
+ To adjust the slider defaults for a child theme use a filter simiar to the following:
33
+
34
+ `add_filter( 'genesis_responsive_slider_settings_defaults', 'my_child_theme_responsive_slider_defaults' );
35
+
36
+ function my_child_theme_responsive_slider_defaults( $defaults ) {
37
+ $defaults = array(
38
+ 'post_type' => 'post',
39
+ 'posts_term' => '',
40
+ 'exclude_terms' => '',
41
+ 'include_exclude' => '',
42
+ 'post_id' => '',
43
+ 'posts_num' => 5,
44
+ 'posts_offset' => 0,
45
+ 'orderby' => 'date',
46
+ 'slideshow_timer' => 4000,
47
+ 'slideshow_delay' => 800,
48
+ 'slideshow_arrows' => 1,
49
+ 'slideshow_pager' => 1,
50
+ 'slideshow_loop' => 1,
51
+ 'slideshow_height' => 400,
52
+ 'slideshow_width' => 920,
53
+ 'slideshow_effect' => 'slide',
54
+ 'slideshow_excerpt_content' => 'excerpts',
55
+ 'slideshow_excerpt_content_limit' => 150,
56
+ 'slideshow_more_text' => '[Continue Reading]',
57
+ 'slideshow_excerpt_show' => 1,
58
+ 'slideshow_excerpt_width' => 50,
59
+ 'location_vertical' => 'bottom',
60
+ 'location_horizontal' => 'right',
61
+ 'slideshow_hide_mobile' => 1
62
+ );
63
+ return $defaults;
64
+ }
65
+ `
66
+
67
+ == Changelog ==
68
+
69
+ = 0.9.5 =
70
+ * Plugin header i18n
71
 
72
  = 0.9.4 =
73
  * Update POT file.
74
 
75
+ = 0.9.2 =
76
+ * add alt attribute to images for validation
77
  * Fix image links
78
 
79
+ = 0.9.1 =
80
+ * Fix slider HTML markup for validation
81
+ * Fix SSL mixed cotent warning
82
+ * Add setting to turn off image links
83
+ * Fix Excerpt More filter to only apply to slides
84
  * UI text changes
85
+
86
+ = 0.9.0 =
87
+ * Beta Release