Features by WooThemes - Version 1.5.0

Version Description

  • Add argument to features widget to accept image pixel size or thumbnail name.
  • Adds basic front-end layout styling.
Download this release

Release Info

Developer jeffikus
Plugin Icon wp plugin Features by WooThemes
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.4 to 1.5.0

assets/css/layout.css ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Front-end layout styles.
3
+ */
4
+ .clearfix {
5
+ zoom: 1;
6
+ }
7
+ .clearfix:before,
8
+ .clearfix:after {
9
+ content: "";
10
+ display: table;
11
+ }
12
+ .clearfix:after {
13
+ clear: both;
14
+ }
15
+ .widget_woothemes_features {
16
+ margin: 0;
17
+ zoom: 1;
18
+ }
19
+ .widget_woothemes_features:before,
20
+ .widget_woothemes_features:after {
21
+ content: "";
22
+ display: table;
23
+ }
24
+ .widget_woothemes_features:after {
25
+ clear: both;
26
+ }
27
+ .widget_woothemes_features > h3 {
28
+ margin: 0 0 .8em;
29
+ }
30
+ .widget_woothemes_features .feature {
31
+ display: block;
32
+ text-align: center;
33
+ margin-bottom: 2em;
34
+ }
35
+ .widget_woothemes_features .feature h3 a {
36
+ color: inherit;
37
+ }
38
+ .widget_woothemes_features .feature img {
39
+ float: none;
40
+ margin: 0 auto 1em auto;
41
+ border: none;
42
+ }
43
+ .widget_woothemes_features .feature .feature-title {
44
+ margin: 0 0 .8em;
45
+ padding: 0;
46
+ font-size: 1.2em;
47
+ border: none;
48
+ }
49
+ @media only screen and (min-width: 980px) {
50
+ #main .widget_woothemes_features .columns-1 .feature {
51
+ width: 100%;
52
+ text-align: left;
53
+ }
54
+ #main .widget_woothemes_features .columns-1 .feature img {
55
+ float: left;
56
+ margin: 0 2em 0 1em;
57
+ }
58
+ #main .widget_woothemes_features .columns-2 .feature {
59
+ width: 47%;
60
+ text-align: left;
61
+ }
62
+ #main .widget_woothemes_features .columns-2 .feature img {
63
+ float: left;
64
+ margin: 0 2em 0 1em;
65
+ }
66
+ #main .widget_woothemes_features .columns-3 .feature {
67
+ width: 30%;
68
+ text-align: center;
69
+ }
70
+ #main .widget_woothemes_features .columns-3 .feature img {
71
+ float: none;
72
+ }
73
+ #main .widget_woothemes_features .columns-4 .feature {
74
+ width: 21%;
75
+ text-align: center;
76
+ }
77
+ #main .widget_woothemes_features .columns-4 .feature img {
78
+ float: none;
79
+ }
80
+ #main .widget_woothemes_features .columns-5 .feature {
81
+ width: 16%;
82
+ text-align: center;
83
+ }
84
+ #main .widget_woothemes_features .columns-5 .feature img {
85
+ float: none;
86
+ }
87
+ #main .widget_woothemes_features .columns-6 .feature {
88
+ width: 12.4%;
89
+ text-align: center;
90
+ }
91
+ #main .widget_woothemes_features .columns-6 .feature img {
92
+ float: none;
93
+ }
94
+ #main .widget_woothemes_features .feature {
95
+ float: left;
96
+ margin-right: 5%;
97
+ }
98
+ #main .widget_woothemes_features .feature.last {
99
+ margin-right: 0;
100
+ }
101
+ #main .widget_woothemes_features .feature .feature-content {
102
+ overflow: hidden;
103
+ }
104
+ #sidebar .widget_woothemes_features .columns-2 .feature,
105
+ #sidebar .widget_woothemes_features .columns-3 .feature,
106
+ #sidebar .widget_woothemes_features .columns-4 .feature,
107
+ #sidebar .widget_woothemes_features .columns-5 .feature,
108
+ #sidebar .widget_woothemes_features .columns-6 .feature {
109
+ width: 100%;
110
+ float: none;
111
+ margin-right: 0;
112
+ clear: both;
113
+ }
114
+ }
assets/css/layout.less ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Front-end layout styles.
3
+ */
4
+
5
+ .clearfix {
6
+ zoom: 1; // For IE 6/7 (trigger hasLayout)
7
+
8
+ &:before, &:after {
9
+ content: "";
10
+ display: table;
11
+ }
12
+
13
+ &:after {
14
+ clear:both;
15
+ }
16
+ }
17
+
18
+ .widget_woothemes_features {
19
+ margin: 0;
20
+ .clearfix;
21
+
22
+ > h3 {
23
+ margin: 0 0 .8em;
24
+ }
25
+
26
+ .feature {
27
+ display:block;
28
+ text-align: center;
29
+ margin-bottom: 2em;
30
+
31
+ h3 a {
32
+ color: inherit;
33
+ }
34
+
35
+ img {
36
+ float: none;
37
+ margin: 0 auto 1em auto;
38
+ border: none;
39
+ }
40
+
41
+ .feature-title {
42
+ margin: 0 0 .8em;
43
+ padding: 0;
44
+ font-size: 1.2em;
45
+ border: none;
46
+ }
47
+ }
48
+ }
49
+
50
+ // Layout
51
+ @media only screen and ( min-width: 980px ) {
52
+
53
+ #main {
54
+ .widget_woothemes_features {
55
+ .columns-1 {
56
+ .feature {
57
+ width: 100%;
58
+ text-align: left;
59
+
60
+ img {
61
+ float: left;
62
+ margin: 0 2em 0 1em;
63
+ }
64
+ }
65
+ }
66
+
67
+ .columns-2 {
68
+ .feature {
69
+ width: 47%;
70
+ text-align:left;
71
+
72
+ img {
73
+ float:left;
74
+ margin: 0 2em 0 1em;
75
+ }
76
+ }
77
+ }
78
+
79
+ .columns-3 {
80
+ .feature {
81
+ width: 30%;
82
+ text-align:center;
83
+
84
+ img {
85
+ float:none;
86
+ }
87
+ }
88
+ }
89
+ .columns-4 {
90
+ .feature {
91
+ width: 21%;
92
+ text-align:center;
93
+
94
+ img {
95
+ float:none;
96
+ }
97
+ }
98
+ }
99
+ .columns-5 {
100
+ .feature {
101
+ width: 16%;
102
+ text-align:center;
103
+ img {
104
+ float:none;
105
+ }
106
+ }
107
+ }
108
+
109
+ .columns-6 {
110
+ .feature {
111
+ width: 12.4%;
112
+ text-align:center;
113
+
114
+ img {
115
+ float:none;
116
+ }
117
+ }
118
+ }
119
+
120
+ .feature {
121
+ float: left;
122
+ margin-right: 5%;
123
+
124
+ &.last {
125
+ margin-right: 0;
126
+ }
127
+
128
+ .feature-content{
129
+ overflow: hidden;
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ #sidebar {
136
+ .widget_woothemes_features {
137
+ .columns-2,
138
+ .columns-3,
139
+ .columns-4,
140
+ .columns-5,
141
+ .columns-6 {
142
+ .feature {
143
+ width: 100%;
144
+ float: none;
145
+ margin-right: 0;
146
+ clear: both;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
classes/class-woothemes-features.php CHANGED
@@ -60,6 +60,7 @@ class Woothemes_Features {
60
  }
61
 
62
  add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) );
 
63
  add_action( 'after_setup_theme', array( $this, 'register_image_sizes' ) );
64
  } // End __construct()
65
 
@@ -337,6 +338,18 @@ class Woothemes_Features {
337
  wp_register_style( 'woothemes-features-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), '1.0.2' );
338
  wp_enqueue_style( 'woothemes-features-admin' );
339
  } // End enqueue_admin_styles()
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
  /**
342
  * Get the settings for the custom fields.
@@ -551,4 +564,16 @@ class Woothemes_Features {
551
  public function ensure_post_thumbnails_support () {
552
  if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
553
  } // End ensure_post_thumbnails_support()
554
- } // End Class
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) );
63
+ add_action( 'after_setup_theme', array( $this, 'load_frontend_layout_css' ), 20 );
64
  add_action( 'after_setup_theme', array( $this, 'register_image_sizes' ) );
65
  } // End __construct()
66
 
338
  wp_register_style( 'woothemes-features-admin', esc_url( $this->assets_url . 'css/admin.css' ), array(), '1.0.2' );
339
  wp_enqueue_style( 'woothemes-features-admin' );
340
  } // End enqueue_admin_styles()
341
+
342
+ /**
343
+ * Enqueue post type layout CSS.
344
+ *
345
+ * @access public
346
+ * @since 1.5.0
347
+ * @return void
348
+ */
349
+ public function enqueue_layout_styles () {
350
+ wp_register_style( 'woothemes-features-layout', esc_url( $this->assets_url . 'css/layout.css' ), array(), '1.0.0' );
351
+ wp_enqueue_style( 'woothemes-features-layout' );
352
+ } // End enqueue_layout_styles()
353
 
354
  /**
355
  * Get the settings for the custom fields.
564
  public function ensure_post_thumbnails_support () {
565
  if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
566
  } // End ensure_post_thumbnails_support()
567
+
568
+ /**
569
+ * Load the front-end layout styles for themes that don't include a built-in support for Features.
570
+ * @since 1.5.0
571
+ * @return void
572
+ */
573
+ public function load_frontend_layout_css () {
574
+ if ( ! current_theme_supports( 'features-by-woothemes' ) || apply_filters( 'woothemes_features_layout_css', false ) ) {
575
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_layout_styles' ), 10 );
576
+ }
577
+ } // End load_frontend_layout_css()
578
+
579
+ } // End Class
classes/class-woothemes-widget-features.php CHANGED
@@ -102,8 +102,12 @@ class Woothemes_Widget_Features extends WP_Widget {
102
  $args['id'] = intval( $instance['specific_id'] );
103
  }
104
 
105
- if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) {
106
- $args['size'] = intval( $instance['size'] );
 
 
 
 
107
  }
108
 
109
  if ( isset( $instance['per_row'] ) && ( 0 < count( $instance['per_row'] ) ) ) {
@@ -158,7 +162,14 @@ class Woothemes_Widget_Features extends WP_Widget {
158
  /* Make sure the integer values are definitely integers. */
159
  $instance['limit'] = intval( $new_instance['limit'] );
160
  $instance['specific_id'] = intval( $new_instance['specific_id'] );
161
- $instance['size'] = intval( $new_instance['size'] );
 
 
 
 
 
 
 
162
  $instance['per_row'] = intval( $new_instance['per_row'] );
163
  $instance['category'] = intval( $new_instance['category'] );
164
 
@@ -211,7 +222,7 @@ class Woothemes_Widget_Features extends WP_Widget {
211
  </p>
212
  <!-- Widget Image Size: Text Input -->
213
  <p>
214
- <label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Image Size (in pixels):', 'woothemes-features' ); ?></label>
215
  <input type="text" name="<?php echo $this->get_field_name( 'size' ); ?>" value="<?php echo $instance['size']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'size' ); ?>" />
216
  </p>
217
  <!-- Widget Per Row: Text Input -->
102
  $args['id'] = intval( $instance['specific_id'] );
103
  }
104
 
105
+ if ( isset( $instance['size'] ) ){
106
+ if( is_numeric( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) {
107
+ $args['size'] = intval( $instance['size'] );
108
+ } else {
109
+ $args['size'] = $instance['size'];
110
+ }
111
  }
112
 
113
  if ( isset( $instance['per_row'] ) && ( 0 < count( $instance['per_row'] ) ) ) {
162
  /* Make sure the integer values are definitely integers. */
163
  $instance['limit'] = intval( $new_instance['limit'] );
164
  $instance['specific_id'] = intval( $new_instance['specific_id'] );
165
+
166
+ if( is_numeric( $new_instance['size'] ) ){
167
+ $instance['size'] = intval( $new_instance['size'] );
168
+ } else {
169
+ $size = sanitize_title_with_dashes( $new_instance['size'] );
170
+ $instance['size'] = in_array( $size, get_intermediate_image_sizes() ) ? $size : 'thumbnail';
171
+ }
172
+
173
  $instance['per_row'] = intval( $new_instance['per_row'] );
174
  $instance['category'] = intval( $new_instance['category'] );
175
 
222
  </p>
223
  <!-- Widget Image Size: Text Input -->
224
  <p>
225
+ <label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Image Size (in pixels or image size name):', 'woothemes-features' ); ?></label>
226
  <input type="text" name="<?php echo $this->get_field_name( 'size' ); ?>" value="<?php echo $instance['size']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'size' ); ?>" />
227
  </p>
228
  <!-- Widget Per Row: Text Input -->
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Features by WooThemes ===
2
- Contributors: woothemes, mattyza, jameskoster, hlashbrooke
3
  Donate link: http://woothemes.com/
4
  Tags: features, widget, shortcode, template-tag, services
5
  Requires at least: 3.4.2
6
- Tested up to: 4.0
7
- Stable tag: 1.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -109,6 +109,10 @@ You sure can, just use the following snippet:
109
 
110
  == Upgrade Notice ==
111
 
 
 
 
 
112
  = 1.4.4 =
113
  * Removes deprecated constructor call for WP_Widget, action hook fix.
114
 
@@ -145,6 +149,11 @@ You sure can, just use the following snippet:
145
 
146
  == Changelog ==
147
 
 
 
 
 
 
148
  = 1.4.4 =
149
  * 2015.07.06
150
  * Fix - Action hook typo (props helgatheviking).
1
  === Features by WooThemes ===
2
+ Contributors: woothemes, mattyza, jameskoster, hlashbrooke, jeffikus, danieldudzic
3
  Donate link: http://woothemes.com/
4
  Tags: features, widget, shortcode, template-tag, services
5
  Requires at least: 3.4.2
6
+ Tested up to: 4.3.1
7
+ Stable tag: 1.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
109
 
110
  == Upgrade Notice ==
111
 
112
+ = 1.5.0 =
113
+ * Add argument to features widget to accept image pixel size or thumbnail name.
114
+ * Adds basic front-end layout styling.
115
+
116
  = 1.4.4 =
117
  * Removes deprecated constructor call for WP_Widget, action hook fix.
118
 
149
 
150
  == Changelog ==
151
 
152
+ = 1.5.0 =
153
+ * 2015.11.20
154
+ * Update - add argument to features widget for pixel size or image thumbnail name.
155
+ * New - Adds basic front-end layout styling.
156
+
157
  = 1.4.4 =
158
  * 2015.07.06
159
  * Fix - Action hook typo (props helgatheviking).
woothemes-features-template.php CHANGED
@@ -89,7 +89,13 @@ function woothemes_features ( $args = '' ) {
89
  $class .= ' first';
90
  }
91
 
92
- $image_size = apply_filters( 'woothemes_features_image_size', array($args['size'], $args['size']), $post );
 
 
 
 
 
 
93
 
94
  $image = get_the_post_thumbnail( $post->ID, $image_size );
95
 
@@ -185,7 +191,16 @@ function woothemes_features_shortcode ( $atts, $content = null ) {
185
  // Fix integers.
186
  if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] );
187
  if ( isset( $args['id'] ) ) $args['id'] = intval( $args['id'] );
188
- if ( isset( $args['size'] ) && ( 0 < intval( $args['size'] ) ) ) $args['size'] = intval( $args['size'] );
 
 
 
 
 
 
 
 
 
189
  if ( isset( $args['per_row'] ) && ( 0 < intval( $args['per_row'] ) ) ) $args['per_row'] = intval( $args['per_row'] );
190
  if ( isset( $args['category'] ) && is_numeric( $args['category'] ) ) $args['category'] = intval( $args['category'] );
191
 
89
  $class .= ' first';
90
  }
91
 
92
+ if( is_numeric( $args['size'] ) ){
93
+ $image_size = array( $args['size'], $args['size'] );
94
+ } else {
95
+ $image_size = $args['size'];
96
+ }
97
+
98
+ $image_size = apply_filters( 'woothemes_features_image_size', $image_size, $post );
99
 
100
  $image = get_the_post_thumbnail( $post->ID, $image_size );
101
 
191
  // Fix integers.
192
  if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] );
193
  if ( isset( $args['id'] ) ) $args['id'] = intval( $args['id'] );
194
+
195
+ if ( isset( $args['size'] ) ){
196
+ if( is_numeric( $args['size'] ) ){
197
+ $args['size'] = intval( $args['size'] );
198
+ } else {
199
+ $size = sanitize_title_with_dashes( $args['size'] );
200
+ $args['size'] = in_array( $size, get_intermediate_image_sizes() ) ? $size : 'thumbnail';
201
+ }
202
+ }
203
+
204
  if ( isset( $args['per_row'] ) && ( 0 < intval( $args['per_row'] ) ) ) $args['per_row'] = intval( $args['per_row'] );
205
  if ( isset( $args['category'] ) && is_numeric( $args['category'] ) ) $args['category'] = intval( $args['category'] );
206
 
woothemes-features.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your feature showcase plugin for WordPress. Show off what features your company, product or service offers, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
- * Version: 1.4.4
8
  * Author URI: http://woothemes.com/
9
  * Text Domain: features-by-woothemes
10
  *
@@ -20,4 +20,4 @@ require_once( 'woothemes-features-template.php' );
20
  require_once( 'classes/class-woothemes-widget-features.php' );
21
  global $woothemes_features;
22
  $woothemes_features = new Woothemes_Features( __FILE__ );
23
- $woothemes_features->version = '1.4.4';
4
  * Plugin URI: http://woothemes.com/
5
  * Description: Hi, I'm your feature showcase plugin for WordPress. Show off what features your company, product or service offers, using our shortcode, widget or template tag.
6
  * Author: WooThemes
7
+ * Version: 1.5.0
8
  * Author URI: http://woothemes.com/
9
  * Text Domain: features-by-woothemes
10
  *
20
  require_once( 'classes/class-woothemes-widget-features.php' );
21
  global $woothemes_features;
22
  $woothemes_features = new Woothemes_Features( __FILE__ );
23
+ $woothemes_features->version = '1.5.0';