Version Description
- Fixed two small (and rare) warnings
- Added translation domain
=
Download this release
Release Info
Developer | janw.oostendorp |
Plugin | Default featured image |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- readme.txt +6 -2
- set-default-featured-image.php +7 -2
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: janwoostendorp
|
3 |
Tags: media, image
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -123,6 +123,10 @@ yes you can with the filter `dfi_thumbnail_html`.
|
|
123 |
* Added plugin images both the plugin header as the thumbnail. Based on the boat WP.org uses in it's theme previews
|
124 |
* Fixed a bug where the ajax calls didn't return the DFI [forum thread](https://wordpress.org/support/topic/dfi-woocommerce-facetwp?replies=10)
|
125 |
|
|
|
|
|
|
|
|
|
126 |
== Upgrade Notice ==
|
127 |
|
128 |
= 1.0 =
|
2 |
Contributors: janwoostendorp
|
3 |
Tags: media, image
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.5
|
6 |
+
Stable tag: 1.5
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
123 |
* Added plugin images both the plugin header as the thumbnail. Based on the boat WP.org uses in it's theme previews
|
124 |
* Fixed a bug where the ajax calls didn't return the DFI [forum thread](https://wordpress.org/support/topic/dfi-woocommerce-facetwp?replies=10)
|
125 |
|
126 |
+
= 1.5 =
|
127 |
+
* Fixed two small (and rare) warnings
|
128 |
+
* Added translation domain
|
129 |
+
|
130 |
== Upgrade Notice ==
|
131 |
|
132 |
= 1.0 =
|
set-default-featured-image.php
CHANGED
@@ -3,9 +3,10 @@
|
|
3 |
* plugin name: Default featured image
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/default-featured-image/
|
5 |
* Description: Allows users to select a default feartured image in the media settings
|
6 |
-
* Version: 1.
|
7 |
* Author: Jan Willem Oostendorp
|
8 |
* License: GPLv2 or later
|
|
|
9 |
*/
|
10 |
|
11 |
class default_featured_image
|
@@ -200,6 +201,10 @@ class default_featured_image
|
|
200 |
function show_dfi( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
|
201 |
$default_thumbnail_id = get_option( 'dfi_image_id' ); //select the default thumb
|
202 |
|
|
|
|
|
|
|
|
|
203 |
// if an image is set return that image
|
204 |
if ( $default_thumbnail_id != $post_thumbnail_id )
|
205 |
return $html;
|
@@ -208,7 +213,7 @@ class default_featured_image
|
|
208 |
$attr['class'] .= " default-featured-img";
|
209 |
} else {
|
210 |
//attachment-$size is a default class `wp_get_attachment_image` would otherwise add. It won't add it if there are classes already there
|
211 |
-
$attr
|
212 |
}
|
213 |
|
214 |
$html = wp_get_attachment_image( $default_thumbnail_id, $size, false, $attr );
|
3 |
* plugin name: Default featured image
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/default-featured-image/
|
5 |
* Description: Allows users to select a default feartured image in the media settings
|
6 |
+
* Version: 1.5
|
7 |
* Author: Jan Willem Oostendorp
|
8 |
* License: GPLv2 or later
|
9 |
+
* Text Domain: default-featured-image
|
10 |
*/
|
11 |
|
12 |
class default_featured_image
|
201 |
function show_dfi( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
|
202 |
$default_thumbnail_id = get_option( 'dfi_image_id' ); //select the default thumb
|
203 |
|
204 |
+
if ( is_array($size)) {
|
205 |
+
$size = 'size-' . implode( 'x', $size);
|
206 |
+
}
|
207 |
+
|
208 |
// if an image is set return that image
|
209 |
if ( $default_thumbnail_id != $post_thumbnail_id )
|
210 |
return $html;
|
213 |
$attr['class'] .= " default-featured-img";
|
214 |
} else {
|
215 |
//attachment-$size is a default class `wp_get_attachment_image` would otherwise add. It won't add it if there are classes already there
|
216 |
+
$attr = array ('class' => "attachment-{$size} default-featured-img");
|
217 |
}
|
218 |
|
219 |
$html = wp_get_attachment_image( $default_thumbnail_id, $size, false, $attr );
|