Features by WooThemes - Version 1.4.0

Version Description

  • WordPress 3.8 support (3.8 is now the minimum required version).
  • Adds the ability to link only features with a custom URL set.
Download this release

Release Info

Developer jameskoster
Plugin Icon wp plugin Features by WooThemes
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.0 to 1.4.0

assets/css/admin.css CHANGED
@@ -1,23 +1,3 @@
1
- #menu-posts-feature .wp-menu-image {
2
- background: none;
3
- background-image: url(../images/features-icon.png);
4
- background-position: 7px -132px !important;
5
- background-repeat: no-repeat;
6
- }
7
- #menu-posts-feature.wp-menu-open .wp-menu-image,
8
- #menu-posts-feature:hover .wp-menu-image {
9
- background-position: 7px -164px !important;
10
- }
11
- #icon-edit.icon32-posts-feature {
12
- background: transparent url(../images/features-icon.png) no-repeat left top;
13
- }
14
- @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2) {
15
- #menu-posts-feature .wp-menu-image {
16
- background-image: url(../images/features-icon@x2.png);
17
- background-size: 32px 187px;
18
- }
19
- #icon-edit.icon32-posts-feature {
20
- background-image: url(../images/features-icon@x2.png);
21
- background-size: 32px 187px;
22
- }
23
- }
1
+ #adminmenu .menu-icon-feature div.wp-menu-image:before {
2
+ content: '\f155';
3
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/css/admin.less CHANGED
@@ -1,37 +1,4 @@
1
  // Features icon
2
- #menu-posts-feature {
3
- .wp-menu-image {
4
- background: none;
5
- background-image: url(../images/features-icon.png);
6
- background-position: 7px -132px !important;
7
- background-repeat: no-repeat;
8
- }
9
- }
10
-
11
- #menu-posts-feature.wp-menu-open, #menu-posts-feature:hover {
12
- .wp-menu-image {
13
- background-position: 7px -164px !important;
14
- }
15
- }
16
-
17
- #icon-edit.icon32-posts-feature {
18
- background: transparent url(../images/features-icon.png) no-repeat left top;
19
- }
20
-
21
- // Retina
22
- @media only screen and (-webkit-min-device-pixel-ratio: 2),
23
- only screen and ( min--moz-device-pixel-ratio: 2),
24
- only screen and ( -o-min-device-pixel-ratio: 2/1),
25
- only screen and ( min-device-pixel-ratio: 2),
26
- {
27
- #menu-posts-feature {
28
- .wp-menu-image {
29
- background-image: url(../images/features-icon@x2.png);
30
- background-size: 32px 187px;
31
- }
32
- }
33
- #icon-edit.icon32-posts-feature {
34
- background-image: url(../images/features-icon@x2.png);
35
- background-size: 32px 187px;
36
- }
37
  }
1
  // Features icon
2
+ #adminmenu .menu-icon-feature div.wp-menu-image:before {
3
+ content: '\f155';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
assets/images/features-icon.png CHANGED
File without changes
assets/images/features-icon@x2.png CHANGED
File without changes
classes/class-woothemes-features-taxonomy.php CHANGED
File without changes
classes/class-woothemes-features.php CHANGED
@@ -90,6 +90,10 @@ class Woothemes_Features {
90
  'menu_name' => __( 'Features', 'woothemes-features' )
91
 
92
  );
 
 
 
 
93
  $args = array(
94
  'labels' => $labels,
95
  'public' => true,
@@ -97,9 +101,9 @@ class Woothemes_Features {
97
  'show_ui' => true,
98
  'show_in_menu' => true,
99
  'query_var' => true,
100
- 'rewrite' => array( 'slug' => 'feature' ),
101
  'capability_type' => 'post',
102
- 'has_archive' => true,
103
  'hierarchical' => false,
104
  'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
105
  'menu_position' => 5,
@@ -399,7 +403,8 @@ class Woothemes_Features {
399
  'orderby' => 'menu_order',
400
  'order' => 'DESC',
401
  'id' => 0,
402
- 'category' => 0
 
403
  );
404
 
405
  $args = wp_parse_args( $args, $defaults );
@@ -466,7 +471,11 @@ class Woothemes_Features {
466
  if ( isset( $meta['_url'][0] ) && '' != $meta['_url'][0] ) {
467
  $query[$k]->url = esc_url( $meta['_url'][0] );
468
  } else {
469
- $query[$k]->url = get_permalink( $v->ID );
 
 
 
 
470
  }
471
  }
472
  } else {
@@ -508,6 +517,7 @@ class Woothemes_Features {
508
  */
509
  public function activation () {
510
  $this->register_plugin_version();
 
511
  } // End activation()
512
 
513
  /**
@@ -522,6 +532,17 @@ class Woothemes_Features {
522
  }
523
  } // End register_plugin_version()
524
 
 
 
 
 
 
 
 
 
 
 
 
525
  /**
526
  * Ensure that "post-thumbnails" support is available for those themes that don't register it.
527
  * @since 1.0.1
90
  'menu_name' => __( 'Features', 'woothemes-features' )
91
 
92
  );
93
+
94
+ $single_slug = apply_filters( 'woothemes_features_single_slug', _x( 'feature', 'single post url slug', 'woothemes-features' ) );
95
+ $archive_slug = apply_filters( 'woothemes_features_archive_slug', _x( 'features', 'post archive url slug', 'woothemes-features' ) );
96
+
97
  $args = array(
98
  'labels' => $labels,
99
  'public' => true,
101
  'show_ui' => true,
102
  'show_in_menu' => true,
103
  'query_var' => true,
104
+ 'rewrite' => array( 'slug' => $single_slug ),
105
  'capability_type' => 'post',
106
+ 'has_archive' => $archive_slug,
107
  'hierarchical' => false,
108
  'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
109
  'menu_position' => 5,
403
  'orderby' => 'menu_order',
404
  'order' => 'DESC',
405
  'id' => 0,
406
+ 'category' => 0,
407
+ 'custom_links_only' => false
408
  );
409
 
410
  $args = wp_parse_args( $args, $defaults );
471
  if ( isset( $meta['_url'][0] ) && '' != $meta['_url'][0] ) {
472
  $query[$k]->url = esc_url( $meta['_url'][0] );
473
  } else {
474
+ if ( true == $args['custom_links_only'] ) {
475
+ $query[$k]->url = '';
476
+ } else {
477
+ $query[$k]->url = get_permalink( $v->ID );
478
+ }
479
  }
480
  }
481
  } else {
517
  */
518
  public function activation () {
519
  $this->register_plugin_version();
520
+ $this->flush_rewrite_rules();
521
  } // End activation()
522
 
523
  /**
532
  }
533
  } // End register_plugin_version()
534
 
535
+ /**
536
+ * Flush the rewrite rules
537
+ * @access public
538
+ * @since 1.3.1
539
+ * @return void
540
+ */
541
+ private function flush_rewrite_rules () {
542
+ $this->register_post_type();
543
+ flush_rewrite_rules();
544
+ } // End flush_rewrite_rules()
545
+
546
  /**
547
  * Ensure that "post-thumbnails" support is available for those themes that don't register it.
548
  * @since 1.0.1
classes/class-woothemes-widget-features.php CHANGED
@@ -92,6 +92,10 @@ class Woothemes_Widget_Features extends WP_Widget {
92
  if ( isset( $instance['per_row'] ) && ( 0 < count( $instance['per_row'] ) ) ) { $args['per_row'] = intval( $instance['per_row'] ); }
93
  if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $args['category'] = intval( $instance['category'] );
94
 
 
 
 
 
95
  // Select boxes.
96
  if ( isset( $instance['orderby'] ) && in_array( $instance['orderby'], array_keys( $this->get_orderby_options() ) ) ) { $args['orderby'] = $instance['orderby']; }
97
  if ( isset( $instance['order'] ) && in_array( $instance['order'], array_keys( $this->get_order_options() ) ) ) { $args['order'] = $instance['order']; }
@@ -123,6 +127,10 @@ class Woothemes_Widget_Features extends WP_Widget {
123
  $instance['per_row'] = intval( $new_instance['per_row'] );
124
  $instance['category'] = intval( $new_instance['category'] );
125
 
 
 
 
 
126
  /* The select box is returning a text value, so we escape it. */
127
  $instance['orderby'] = esc_attr( $new_instance['orderby'] );
128
  $instance['order'] = esc_attr( $new_instance['order'] );
@@ -149,7 +157,9 @@ class Woothemes_Widget_Features extends WP_Widget {
149
  'specific_id' => '',
150
  'size' => 50,
151
  'per_row' => 3,
152
- 'category' => 0
 
 
153
  );
154
 
155
  $instance = wp_parse_args( (array) $instance, $defaults );
@@ -200,6 +210,16 @@ class Woothemes_Widget_Features extends WP_Widget {
200
  wp_dropdown_categories( $dropdown_args );
201
  ?>
202
  </p>
 
 
 
 
 
 
 
 
 
 
203
  <!-- Widget ID: Text Input -->
204
  <p>
205
  <label for="<?php echo $this->get_field_id( 'specific_id' ); ?>"><?php _e( 'Specific ID (optional):', 'woothemes-features' ); ?></label>
92
  if ( isset( $instance['per_row'] ) && ( 0 < count( $instance['per_row'] ) ) ) { $args['per_row'] = intval( $instance['per_row'] ); }
93
  if ( isset( $instance['category'] ) && is_numeric( $instance['category'] ) ) $args['category'] = intval( $instance['category'] );
94
 
95
+ // Boolean values.
96
+ if ( isset( $instance['link_title'] ) && ( 1 == $instance['link_title'] ) ) { $args['link_title'] = true; } else { $args['link_title'] = false; }
97
+ if ( isset( $instance['custom_links_only'] ) && ( 1 == $instance['custom_links_only'] ) ) { $args['custom_links_only'] = true; } else { $args['custom_links_only'] = false; }
98
+
99
  // Select boxes.
100
  if ( isset( $instance['orderby'] ) && in_array( $instance['orderby'], array_keys( $this->get_orderby_options() ) ) ) { $args['orderby'] = $instance['orderby']; }
101
  if ( isset( $instance['order'] ) && in_array( $instance['order'], array_keys( $this->get_order_options() ) ) ) { $args['order'] = $instance['order']; }
127
  $instance['per_row'] = intval( $new_instance['per_row'] );
128
  $instance['category'] = intval( $new_instance['category'] );
129
 
130
+ /* The checkbox is returning a Boolean (true/false), so we check for that. */
131
+ $instance['link_title'] = (bool) esc_attr( $new_instance['link_title'] );
132
+ $instance['custom_links_only'] = (bool) esc_attr( $new_instance['custom_links_only'] );
133
+
134
  /* The select box is returning a text value, so we escape it. */
135
  $instance['orderby'] = esc_attr( $new_instance['orderby'] );
136
  $instance['order'] = esc_attr( $new_instance['order'] );
157
  'specific_id' => '',
158
  'size' => 50,
159
  'per_row' => 3,
160
+ 'category' => 0,
161
+ 'link_title' => true,
162
+ 'custom_links_only' => false
163
  );
164
 
165
  $instance = wp_parse_args( (array) $instance, $defaults );
210
  wp_dropdown_categories( $dropdown_args );
211
  ?>
212
  </p>
213
+ <!-- Widget Link Titles: Checkbox Input -->
214
+ <p>
215
+ <input id="<?php echo $this->get_field_id( 'link_title' ); ?>" name="<?php echo $this->get_field_name( 'link_title' ); ?>" type="checkbox"<?php checked( $instance['link_title'], 1 ); ?> />
216
+ <label for="<?php echo $this->get_field_id( 'link_title' ); ?>"><?php _e( 'Link Titles', 'woothemes-features' ); ?></label>
217
+ </p>
218
+ <!-- Widget Custom Links Only: Checkbox Input -->
219
+ <p>
220
+ <input id="<?php echo $this->get_field_id( 'custom_links_only' ); ?>" name="<?php echo $this->get_field_name( 'custom_links_only' ); ?>" type="checkbox"<?php checked( $instance['custom_links_only'], 1 ); ?> />
221
+ <label for="<?php echo $this->get_field_id( 'custom_links_only' ); ?>"><?php _e( 'Link only Titles with Custom Links', 'woothemes-features' ); ?></label>
222
+ </p>
223
  <!-- Widget ID: Text Input -->
224
  <p>
225
  <label for="<?php echo $this->get_field_id( 'specific_id' ); ?>"><?php _e( 'Specific ID (optional):', 'woothemes-features' ); ?></label>
lang/woothemes-features-en_GB.po CHANGED
@@ -1,15 +1,16 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Features v1.3.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2013-04-30 12:39:20+0000\n"
7
  "Last-Translator: Matt <matt@woothemes.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
13
  "X-Poedit-Language: English\n"
14
  "X-Poedit-Country: UNITED KINGDOM\n"
15
  "X-Poedit-SourceCharset: utf-8\n"
@@ -106,74 +107,74 @@ msgstr ""
106
  msgid "No %s Found In Trash"
107
  msgstr ""
108
 
109
- #: classes/class-woothemes-features.php:161
110
  #@ woothemes-features
111
  msgid "Image"
112
  msgstr ""
113
 
114
- #: classes/class-woothemes-features.php:195
115
  #, php-format
116
  #@ woothemes-features
117
  msgid "Feature updated. %sView feature%s"
118
  msgstr ""
119
 
120
- #: classes/class-woothemes-features.php:196
121
  #@ woothemes-features
122
  msgid "Custom field updated."
123
  msgstr ""
124
 
125
- #: classes/class-woothemes-features.php:197
126
  #@ woothemes-features
127
  msgid "Custom field deleted."
128
  msgstr ""
129
 
130
- #: classes/class-woothemes-features.php:198
131
  #@ woothemes-features
132
  msgid "Feature updated."
133
  msgstr ""
134
 
135
  #. translators: %s: date and time of the revision
136
- #: classes/class-woothemes-features.php:200
137
  #, php-format
138
  #@ woothemes-features
139
  msgid "Feature restored to revision from %s"
140
  msgstr ""
141
 
142
- #: classes/class-woothemes-features.php:201
143
  #, php-format
144
  #@ woothemes-features
145
  msgid "Feature published. %sView feature%s"
146
  msgstr ""
147
 
148
- #: classes/class-woothemes-features.php:202
149
  #@ default
150
  msgid "Feature saved."
151
  msgstr ""
152
 
153
- #: classes/class-woothemes-features.php:203
154
  #, php-format
155
  #@ woothemes-features
156
  msgid "Feature submitted. %sPreview feature%s"
157
  msgstr ""
158
 
159
- #: classes/class-woothemes-features.php:204
160
  #, php-format
161
  #@ woothemes-features
162
  msgid "Feature scheduled for: %1$s. %2$sPreview feature%3$s"
163
  msgstr ""
164
 
165
- #: classes/class-woothemes-features.php:206
166
  #@ default
167
  msgid "M j, Y @ G:i"
168
  msgstr ""
169
 
170
- #: classes/class-woothemes-features.php:207
171
  #, php-format
172
  #@ woothemes-features
173
  msgid "Feature draft updated. %sPreview feature%s"
174
  msgstr ""
175
 
176
- #: classes/class-woothemes-features.php:320
177
  #@ woothemes-features
178
  msgid "Enter the feature title here"
179
  msgstr ""
@@ -248,17 +249,17 @@ msgstr ""
248
  msgid "Descending"
249
  msgstr ""
250
 
251
- #: classes/class-woothemes-features.php:221
252
  #@ woothemes-features
253
  msgid "Feature Details"
254
  msgstr ""
255
 
256
- #: classes/class-woothemes-features.php:346
257
  #@ woothemes-features
258
  msgid "URL"
259
  msgstr ""
260
 
261
- #: classes/class-woothemes-features.php:347
262
  #@ woothemes-features
263
  msgid "Enter a URL that applies to this feature (for example: http://woothemes.com/)."
264
  msgstr ""
@@ -348,3 +349,15 @@ msgstr ""
348
  msgid "All"
349
  msgstr ""
350
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Features v1.3.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2013-07-31 12:39:51+0000\n"
7
  "Last-Translator: Matt <matt@woothemes.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Generator: CSL v1.x\n"
14
  "X-Poedit-Language: English\n"
15
  "X-Poedit-Country: UNITED KINGDOM\n"
16
  "X-Poedit-SourceCharset: utf-8\n"
107
  msgid "No %s Found In Trash"
108
  msgstr ""
109
 
110
+ #: classes/class-woothemes-features.php:165
111
  #@ woothemes-features
112
  msgid "Image"
113
  msgstr ""
114
 
115
+ #: classes/class-woothemes-features.php:199
116
  #, php-format
117
  #@ woothemes-features
118
  msgid "Feature updated. %sView feature%s"
119
  msgstr ""
120
 
121
+ #: classes/class-woothemes-features.php:200
122
  #@ woothemes-features
123
  msgid "Custom field updated."
124
  msgstr ""
125
 
126
+ #: classes/class-woothemes-features.php:201
127
  #@ woothemes-features
128
  msgid "Custom field deleted."
129
  msgstr ""
130
 
131
+ #: classes/class-woothemes-features.php:202
132
  #@ woothemes-features
133
  msgid "Feature updated."
134
  msgstr ""
135
 
136
  #. translators: %s: date and time of the revision
137
+ #: classes/class-woothemes-features.php:204
138
  #, php-format
139
  #@ woothemes-features
140
  msgid "Feature restored to revision from %s"
141
  msgstr ""
142
 
143
+ #: classes/class-woothemes-features.php:205
144
  #, php-format
145
  #@ woothemes-features
146
  msgid "Feature published. %sView feature%s"
147
  msgstr ""
148
 
149
+ #: classes/class-woothemes-features.php:206
150
  #@ default
151
  msgid "Feature saved."
152
  msgstr ""
153
 
154
+ #: classes/class-woothemes-features.php:207
155
  #, php-format
156
  #@ woothemes-features
157
  msgid "Feature submitted. %sPreview feature%s"
158
  msgstr ""
159
 
160
+ #: classes/class-woothemes-features.php:208
161
  #, php-format
162
  #@ woothemes-features
163
  msgid "Feature scheduled for: %1$s. %2$sPreview feature%3$s"
164
  msgstr ""
165
 
166
+ #: classes/class-woothemes-features.php:210
167
  #@ default
168
  msgid "M j, Y @ G:i"
169
  msgstr ""
170
 
171
+ #: classes/class-woothemes-features.php:211
172
  #, php-format
173
  #@ woothemes-features
174
  msgid "Feature draft updated. %sPreview feature%s"
175
  msgstr ""
176
 
177
+ #: classes/class-woothemes-features.php:324
178
  #@ woothemes-features
179
  msgid "Enter the feature title here"
180
  msgstr ""
249
  msgid "Descending"
250
  msgstr ""
251
 
252
+ #: classes/class-woothemes-features.php:225
253
  #@ woothemes-features
254
  msgid "Feature Details"
255
  msgstr ""
256
 
257
+ #: classes/class-woothemes-features.php:350
258
  #@ woothemes-features
259
  msgid "URL"
260
  msgstr ""
261
 
262
+ #: classes/class-woothemes-features.php:351
263
  #@ woothemes-features
264
  msgid "Enter a URL that applies to this feature (for example: http://woothemes.com/)."
265
  msgstr ""
349
  msgid "All"
350
  msgstr ""
351
 
352
+ #: classes/class-woothemes-features.php:94
353
+ #@ woothemes-features
354
+ msgctxt "single post url slug"
355
+ msgid "feature"
356
+ msgstr ""
357
+
358
+ #: classes/class-woothemes-features.php:95
359
+ #@ woothemes-features
360
+ msgctxt "post archive url slug"
361
+ msgid "features"
362
+ msgstr ""
363
+
lang/woothemes-features-xx_XX.pot CHANGED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Features by WooThemes ===
2
- Contributors: woothemes, mattyza, jameskoster
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: 3.5.1
7
- Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -35,6 +35,7 @@ To add arguments to this, please use any of the following arguments, using the s
35
  * 'size' => 50 (the pixel dimensions of the image)
36
  * 'per_row' => 3 (when creating rows, how many items display in a single row?)
37
  * 'link_title' => true (link the feature's title to it's permalink)
 
38
  * 'title' => '' (an optional title)
39
  * 'before' => '&lt;div class="widget widget_woothemes_features"&gt;' (the starting HTML, wrapping the features)
40
  * 'after' => '&lt;/div&gt;' (the ending HTML, wrapping the features)
@@ -102,6 +103,14 @@ We encourage everyone to contribute their ideas, thoughts and code snippets. Thi
102
 
103
  == Upgrade Notice ==
104
 
 
 
 
 
 
 
 
 
105
  = 1.3.0 =
106
  * Adds "woothemes_features_content" filter and shortcode support. Adds "feature-category" taxonomy.
107
 
@@ -127,6 +136,20 @@ We encourage everyone to contribute their ideas, thoughts and code snippets. Thi
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  = 1.3.0 =
131
  * 2013-04-30.
132
  * Adds "woothemes_features_content" filter for modifying the content of features when outputting the features list.
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: 3.8.0
7
+ Stable tag: 1.4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
35
  * 'size' => 50 (the pixel dimensions of the image)
36
  * 'per_row' => 3 (when creating rows, how many items display in a single row?)
37
  * 'link_title' => true (link the feature's title to it's permalink)
38
+ * 'custom_links_only' => true (link the feature's title only if a custom URL is set)
39
  * 'title' => '' (an optional title)
40
  * 'before' => '&lt;div class="widget widget_woothemes_features"&gt;' (the starting HTML, wrapping the features)
41
  * 'after' => '&lt;/div&gt;' (the ending HTML, wrapping the features)
103
 
104
  == Upgrade Notice ==
105
 
106
+ = 1.4.0 =
107
+ * WordPress 3.8 support (3.8 is now the minimum required version).
108
+ * Adds the ability to link only features with a custom URL set.
109
+
110
+ = 1.3.1 =
111
+ * Adds filters for the single features and features archives URL slugs
112
+ * Adds a flush_rewrite_rules() call on plugin activation
113
+
114
  = 1.3.0 =
115
  * Adds "woothemes_features_content" filter and shortcode support. Adds "feature-category" taxonomy.
116
 
136
 
137
  == Changelog ==
138
 
139
+ = 1.4.0 =
140
+ * 2014-01-17
141
+ * UI tweaks for WordPress 3.8.
142
+ * Default args are now filterable via woothemes_features_default_args.
143
+ * Adds the ability to link only features with a custom URL set.
144
+ * Adds a new %%PERMALINK%% tag to the templating engine.
145
+ * Adjusts the 'id' parameter to cater for multipe ID values.
146
+
147
+ = 1.3.1 =
148
+ * 2013-08-01.
149
+ * Adds "woothemes_features_single_slug" as a filter for the single feature URL slug
150
+ * Adds "woothemes_features_archive_slug" as a filter for the features archive URL slug
151
+ * Adds a flush_rewrite_rules() call on plugin activation
152
+
153
  = 1.3.0 =
154
  * 2013-04-30.
155
  * Adds "woothemes_features_content" filter for modifying the content of features when outputting the features list.
woothemes-features-template.php CHANGED
@@ -31,22 +31,23 @@ if ( ! function_exists( 'woothemes_features' ) ) {
31
  function woothemes_features ( $args = '' ) {
32
  global $post;
33
 
34
- $defaults = array(
35
- 'limit' => 5,
36
- 'orderby' => 'menu_order',
37
- 'order' => 'DESC',
38
- 'id' => 0,
39
- 'echo' => true,
40
- 'size' => 50,
41
- 'per_row' => 3,
42
- 'link_title' => true,
43
- 'title' => '',
44
- 'before' => '<div class="widget widget_woothemes_features">',
45
- 'after' => '</div><!--/.widget widget_woothemes_features-->',
46
- 'before_title' => '<h2>',
47
- 'after_title' => '</h2>',
48
- 'category' => 0
49
- );
 
50
 
51
  $args = wp_parse_args( $args, $defaults );
52
 
@@ -88,16 +89,19 @@ function woothemes_features ( $args = '' ) {
88
  $class .= ' first';
89
  }
90
 
 
 
 
91
 
92
  $title = get_the_title();
93
- if ( true == $args['link_title'] ) {
94
- $post->image = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $post->image . '</a>';
95
  $title = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>';
96
  }
97
 
98
  // Optionally display the image, if it is available.
99
- if ( isset( $post->image ) && ( '' != $post->image ) ) {
100
- $template = str_replace( '%%IMAGE%%', $post->image, $template );
101
  } else {
102
  $template = str_replace( '%%IMAGE%%', '', $template );
103
  }
@@ -105,6 +109,8 @@ function woothemes_features ( $args = '' ) {
105
  $template = str_replace( '%%CLASS%%', $class, $template );
106
  $template = str_replace( '%%TITLE%%', $title, $template );
107
 
 
 
108
  if ( '' != $post->post_excerpt ) {
109
  $content = get_the_excerpt();
110
  } else {
@@ -160,6 +166,7 @@ function woothemes_features_shortcode ( $atts, $content = null ) {
160
  'size' => 50,
161
  'per_row' => 3,
162
  'link_title' => true,
 
163
  'category' => 0
164
  );
165
 
@@ -176,7 +183,7 @@ function woothemes_features_shortcode ( $atts, $content = null ) {
176
  if ( isset( $args['category'] ) && is_numeric( $args['category'] ) ) $args['category'] = intval( $args['category'] );
177
 
178
  // Fix booleans.
179
- foreach ( array( 'link_title' ) as $k => $v ) {
180
  if ( isset( $args[$v] ) && ( 'true' == $args[$v] ) ) {
181
  $args[$v] = true;
182
  } else {
31
  function woothemes_features ( $args = '' ) {
32
  global $post;
33
 
34
+ $defaults = apply_filters( 'woothemes_features_default_args', array(
35
+ 'limit' => 5,
36
+ 'orderby' => 'menu_order',
37
+ 'order' => 'DESC',
38
+ 'id' => 0,
39
+ 'echo' => true,
40
+ 'size' => 50,
41
+ 'per_row' => 3,
42
+ 'link_title' => true,
43
+ 'custom_links_only' => true,
44
+ 'title' => '',
45
+ 'before' => '<div class="widget widget_woothemes_features">',
46
+ 'after' => '</div><!--/.widget widget_woothemes_features-->',
47
+ 'before_title' => '<h2>',
48
+ 'after_title' => '</h2>',
49
+ 'category' => 0
50
+ ) );
51
 
52
  $args = wp_parse_args( $args, $defaults );
53
 
89
  $class .= ' first';
90
  }
91
 
92
+ $image_size = apply_filters( 'woothemes_features_image_size', 'thumbnail', $post );
93
+
94
+ $image = get_the_post_thumbnail( $post->ID, $image_size );
95
 
96
  $title = get_the_title();
97
+ if ( true == $args['link_title'] && '' != $post->url ) {
98
+ $image = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $image . '</a>';
99
  $title = '<a href="' . esc_url( $post->url ) . '" title="' . esc_attr( $title ) . '">' . $title . '</a>';
100
  }
101
 
102
  // Optionally display the image, if it is available.
103
+ if ( has_post_thumbnail() ) {
104
+ $template = str_replace( '%%IMAGE%%', $image, $template );
105
  } else {
106
  $template = str_replace( '%%IMAGE%%', '', $template );
107
  }
109
  $template = str_replace( '%%CLASS%%', $class, $template );
110
  $template = str_replace( '%%TITLE%%', $title, $template );
111
 
112
+ $template = str_replace( '%%PERMALINK%%', esc_url( get_permalink( get_the_ID() ) ), $template );
113
+
114
  if ( '' != $post->post_excerpt ) {
115
  $content = get_the_excerpt();
116
  } else {
166
  'size' => 50,
167
  'per_row' => 3,
168
  'link_title' => true,
169
+ 'custom_links_only' => false,
170
  'category' => 0
171
  );
172
 
183
  if ( isset( $args['category'] ) && is_numeric( $args['category'] ) ) $args['category'] = intval( $args['category'] );
184
 
185
  // Fix booleans.
186
+ foreach ( array( 'link_title', 'custom_links_only' ) as $k => $v ) {
187
  if ( isset( $args[$v] ) && ( 'true' == $args[$v] ) ) {
188
  $args[$v] = true;
189
  } else {
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.3.0
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
@@ -19,5 +19,4 @@ require_once( 'woothemes-features-template.php' );
19
  require_once( 'classes/class-woothemes-widget-features.php' );
20
  global $woothemes_features;
21
  $woothemes_features = new Woothemes_Features( __FILE__ );
22
- $woothemes_features->version = '1.3.0';
23
- ?>
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.0
8
  * Author URI: http://woothemes.com/
9
  *
10
  * @package WordPress
19
  require_once( 'classes/class-woothemes-widget-features.php' );
20
  global $woothemes_features;
21
  $woothemes_features = new Woothemes_Features( __FILE__ );
22
+ $woothemes_features->version = '1.4.0';