Version Description
- Allows to prioritize the internal image rather than the external one, if both exist.
Download this release
Release Info
Developer | marceljm |
Plugin | Featured Image From URL |
Version | 1.8.4 |
Comparing to | |
See all releases |
Code changes from version 1.8.3 to 1.8.4
- admin/html/menu.html +44 -14
- admin/html/meta-box.html +2 -4
- admin/menu.php +3 -0
- featured-image-from-url.php +1 -1
- includes/thumbnail.php +29 -0
- readme.txt +8 -2
admin/html/menu.html
CHANGED
@@ -136,24 +136,12 @@
|
|
136 |
</form>
|
137 |
</div>
|
138 |
|
139 |
-
<a name="default"></a>
|
140 |
-
|
141 |
<div class="box">
|
142 |
-
|
143 |
<h2>Default External Featured Image</h2>
|
144 |
-
|
145 |
<div class="greybox">
|
146 |
-
|
147 |
Here you can define the URL of a default external featured image that will be shown when you create/update a post/page/product without an internal/external featured image.
|
148 |
-
|
149 |
-
<br><br>
|
150 |
-
|
151 |
-
<i>If this new FREE feature is useful to you, please cherish my work. Give FIFU a <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">5-star</a> rating!</i>
|
152 |
-
|
153 |
</div>
|
154 |
-
|
155 |
<br>
|
156 |
-
|
157 |
<form
|
158 |
id="fifu_form_default_url"
|
159 |
action="javascript:void(0)"
|
@@ -168,7 +156,6 @@
|
|
168 |
<input type="submit"
|
169 |
value="Submit" >
|
170 |
</form>
|
171 |
-
|
172 |
</div>
|
173 |
|
174 |
<div class="box">
|
@@ -329,6 +316,47 @@
|
|
329 |
</form>
|
330 |
</div>
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
<div class="box">
|
333 |
<h2>Social Tags</h2>
|
334 |
<div class="greybox" id="grad1">
|
@@ -425,7 +453,9 @@
|
|
425 |
<div class="greybox" id="grad1">
|
426 |
You can use Featured Image from URL with WP All Import plugin. For that, use the custom field <b>fifu_image_url</b>.<br/><br/> The other custom fields supported by FIFU are listed below, in the section WP REST API > Plugin Fields.
|
427 |
<br/><br/>
|
428 |
-
|
|
|
|
|
429 |
</div>
|
430 |
</div>
|
431 |
|
136 |
</form>
|
137 |
</div>
|
138 |
|
|
|
|
|
139 |
<div class="box">
|
|
|
140 |
<h2>Default External Featured Image</h2>
|
|
|
141 |
<div class="greybox">
|
|
|
142 |
Here you can define the URL of a default external featured image that will be shown when you create/update a post/page/product without an internal/external featured image.
|
|
|
|
|
|
|
|
|
|
|
143 |
</div>
|
|
|
144 |
<br>
|
|
|
145 |
<form
|
146 |
id="fifu_form_default_url"
|
147 |
action="javascript:void(0)"
|
156 |
<input type="submit"
|
157 |
value="Submit" >
|
158 |
</form>
|
|
|
159 |
</div>
|
160 |
|
161 |
<div class="box">
|
316 |
</form>
|
317 |
</div>
|
318 |
|
319 |
+
<a name="priority"></a>
|
320 |
+
|
321 |
+
<div class="box">
|
322 |
+
<h2>Priority</h2>
|
323 |
+
<div class="greybox" id="grad1">
|
324 |
+
Enable the toggle below to prioritize the internal image rather than the external one, if both exist.
|
325 |
+
<br><br>
|
326 |
+
<i>If this new FREE feature is useful to you, please cherish my work. Give FIFU a <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">5-star</a> rating!</i>
|
327 |
+
</div>
|
328 |
+
<br>
|
329 |
+
<table style="text-align:left">
|
330 |
+
<tr>
|
331 |
+
<th>
|
332 |
+
<form
|
333 |
+
id="fifu_form_priority"
|
334 |
+
action="javascript:void(0)"
|
335 |
+
method="post">
|
336 |
+
<input
|
337 |
+
type="image"
|
338 |
+
href="javascript:void(0)"
|
339 |
+
id="fifu_toggle_priority"
|
340 |
+
onclick="invert('priority')"
|
341 |
+
name="fifu_toggle_priority"
|
342 |
+
class="<?php echo $enable_priority; ?>"
|
343 |
+
value=""
|
344 |
+
style="display:block">
|
345 |
+
|
346 |
+
<input
|
347 |
+
type="hidden"
|
348 |
+
id="fifu_input_priority"
|
349 |
+
name="fifu_input_priority"
|
350 |
+
value="" >
|
351 |
+
</form>
|
352 |
+
</th>
|
353 |
+
<th>
|
354 |
+
prioritize the internal image
|
355 |
+
</th>
|
356 |
+
</tr>
|
357 |
+
</table>
|
358 |
+
</div>
|
359 |
+
|
360 |
<div class="box">
|
361 |
<h2>Social Tags</h2>
|
362 |
<div class="greybox" id="grad1">
|
453 |
<div class="greybox" id="grad1">
|
454 |
You can use Featured Image from URL with WP All Import plugin. For that, use the custom field <b>fifu_image_url</b>.<br/><br/> The other custom fields supported by FIFU are listed below, in the section WP REST API > Plugin Fields.
|
455 |
<br/><br/>
|
456 |
+
<div class="greybox" id="grad2">
|
457 |
+
<b>Premium feature</b><br><br>But if you have a list of URLs delimited by "|", it's possible to use that with the custom field <b>fifu_list_url</b>. In this case, the first image will be considered the featured image and the others will be in the product image gallery. For sliders, use <b>fifu_slider_list_url</b>.
|
458 |
+
</div>
|
459 |
</div>
|
460 |
</div>
|
461 |
|
admin/html/meta-box.html
CHANGED
@@ -50,10 +50,8 @@
|
|
50 |
<div style="<?php echo $show_news?>">
|
51 |
<br>
|
52 |
<hr>
|
53 |
-
<p style="font-size: 12px; padding: 5px; border-left: 6px solid #
|
54 |
-
background-color: #eee; border-radius: 25px 5px;">New:
|
55 |
-
<p style="font-size: 12px; padding: 5px; border-left: 6px solid #7e7c82; color: black;
|
56 |
-
background-color: #eee; border-radius: 25px 5px;">New: <a href="admin.php?page=featured-image-from-url#all">schedule</a> an event to set all first images as featured images. So it can run hourly, daily etc.</p>
|
57 |
<center>
|
58 |
<table>
|
59 |
<tbody>
|
50 |
<div style="<?php echo $show_news?>">
|
51 |
<br>
|
52 |
<hr>
|
53 |
+
<p style="font-size: 12px; padding: 5px; border-left: 6px solid #41f450; color: black;
|
54 |
+
background-color: #eee; border-radius: 25px 5px;">New: <a href="admin.php?page=featured-image-from-url#priority">prioritize</a> the internal image rather than the external one, if both exist. (11% of <a href="https://goo.gl/forms/TxLdhwXTqsuO5BHg2">votes</a>)</p>
|
|
|
|
|
55 |
<center>
|
56 |
<table>
|
57 |
<tbody>
|
admin/menu.php
CHANGED
@@ -26,6 +26,7 @@ function fifu_get_menu_html() {
|
|
26 |
$enable_pop_first = get_option('fifu_pop_first');
|
27 |
$enable_ovw_first = get_option('fifu_ovw_first');
|
28 |
$column_height = get_option('fifu_column_height');
|
|
|
29 |
|
30 |
$array_cpt = array();
|
31 |
for ($x = 0; $x <= 4; $x++)
|
@@ -55,6 +56,7 @@ function fifu_get_menu_settings() {
|
|
55 |
fifu_get_setting('fifu_pop_first');
|
56 |
fifu_get_setting('fifu_ovw_first');
|
57 |
fifu_get_setting('fifu_column_height');
|
|
|
58 |
|
59 |
for ($x = 0; $x <= 4; $x++)
|
60 |
fifu_get_setting('fifu_cpt' . $x);
|
@@ -89,6 +91,7 @@ function fifu_update_menu_options() {
|
|
89 |
fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
|
90 |
fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
|
91 |
fifu_update_option('fifu_input_column_height', 'fifu_column_height');
|
|
|
92 |
|
93 |
for ($x = 0; $x <= 4; $x++)
|
94 |
fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
|
26 |
$enable_pop_first = get_option('fifu_pop_first');
|
27 |
$enable_ovw_first = get_option('fifu_ovw_first');
|
28 |
$column_height = get_option('fifu_column_height');
|
29 |
+
$enable_priority = get_option('fifu_priority');
|
30 |
|
31 |
$array_cpt = array();
|
32 |
for ($x = 0; $x <= 4; $x++)
|
56 |
fifu_get_setting('fifu_pop_first');
|
57 |
fifu_get_setting('fifu_ovw_first');
|
58 |
fifu_get_setting('fifu_column_height');
|
59 |
+
fifu_get_setting('fifu_priority');
|
60 |
|
61 |
for ($x = 0; $x <= 4; $x++)
|
62 |
fifu_get_setting('fifu_cpt' . $x);
|
91 |
fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
|
92 |
fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
|
93 |
fifu_update_option('fifu_input_column_height', 'fifu_column_height');
|
94 |
+
fifu_update_option('fifu_input_priority', 'fifu_priority');
|
95 |
|
96 |
for ($x = 0; $x <= 4; $x++)
|
97 |
fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
|
featured-image-from-url.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Featured Image From URL
|
5 |
* Plugin URI: http://featuredimagefromurl.com/
|
6 |
* Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
|
7 |
-
* Version: 1.8.
|
8 |
* Author: Marcel Jacques Machado
|
9 |
* Author URI: https://www.linkedin.com/in/marceljm/
|
10 |
*/
|
4 |
* Plugin Name: Featured Image From URL
|
5 |
* Plugin URI: http://featuredimagefromurl.com/
|
6 |
* Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
|
7 |
+
* Version: 1.8.4
|
8 |
* Author: Marcel Jacques Machado
|
9 |
* Author URI: https://www.linkedin.com/in/marceljm/
|
10 |
*/
|
includes/thumbnail.php
CHANGED
@@ -85,6 +85,9 @@ function fifu_add_to_content($content) {
|
|
85 |
add_filter('wp_get_attachment_url', 'fifu_replace_attachment_url', 10, 2);
|
86 |
|
87 |
function fifu_replace_attachment_url($att_url, $att_id) {
|
|
|
|
|
|
|
88 |
if ($att_id == get_post_thumbnail_id(get_the_ID())) {
|
89 |
$url = fifu_main_image_url(get_the_ID());
|
90 |
if ($url)
|
@@ -96,6 +99,9 @@ function fifu_replace_attachment_url($att_url, $att_id) {
|
|
96 |
add_filter('wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 10, 2);
|
97 |
|
98 |
function fifu_replace_attachment_image_src($image, $att_id) {
|
|
|
|
|
|
|
99 |
if ($att_id == get_post_thumbnail_id(get_the_ID())) {
|
100 |
$url = fifu_main_image_url(get_the_ID());
|
101 |
if ($url) {
|
@@ -138,3 +144,26 @@ function fifu_lazy_url($url) {
|
|
138 |
return 'src="' . $url . '"';
|
139 |
return (is_home() || (class_exists('WooCommerce') && is_shop()) ? 'data-src="' : 'src="') . $url . '"';
|
140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
add_filter('wp_get_attachment_url', 'fifu_replace_attachment_url', 10, 2);
|
86 |
|
87 |
function fifu_replace_attachment_url($att_url, $att_id) {
|
88 |
+
if (fifu_show_internal_instead_of_external(get_the_ID()))
|
89 |
+
return $att_url;
|
90 |
+
|
91 |
if ($att_id == get_post_thumbnail_id(get_the_ID())) {
|
92 |
$url = fifu_main_image_url(get_the_ID());
|
93 |
if ($url)
|
99 |
add_filter('wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 10, 2);
|
100 |
|
101 |
function fifu_replace_attachment_image_src($image, $att_id) {
|
102 |
+
if (fifu_show_internal_instead_of_external(get_the_ID()))
|
103 |
+
return $image;
|
104 |
+
|
105 |
if ($att_id == get_post_thumbnail_id(get_the_ID())) {
|
106 |
$url = fifu_main_image_url(get_the_ID());
|
107 |
if ($url) {
|
144 |
return 'src="' . $url . '"';
|
145 |
return (is_home() || (class_exists('WooCommerce') && is_shop()) ? 'data-src="' : 'src="') . $url . '"';
|
146 |
}
|
147 |
+
|
148 |
+
function fifu_is_fake_disabled() {
|
149 |
+
return get_option('fifu_fake') == 'toggleoff';
|
150 |
+
}
|
151 |
+
|
152 |
+
function fifu_has_internal_image($post_id) {
|
153 |
+
$featured_image = get_post_meta($post_id, '_thumbnail_id', true);
|
154 |
+
return $featured_image && $featured_image != -1 && $featured_image != get_option('fifu_fake_attach_id');
|
155 |
+
}
|
156 |
+
|
157 |
+
function fifu_show_internal_instead_of_external($post_id) {
|
158 |
+
if (!fifu_has_internal_image($post_id))
|
159 |
+
return false;
|
160 |
+
return fifu_is_in_editor() || fifu_internal_priority();
|
161 |
+
}
|
162 |
+
|
163 |
+
function fifu_is_in_editor() {
|
164 |
+
return !is_admin() ? false : get_current_screen()->parent_base == 'edit';
|
165 |
+
}
|
166 |
+
|
167 |
+
function fifu_internal_priority() {
|
168 |
+
return get_option('fifu_priority') == 'toggleon';
|
169 |
+
}
|
readme.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: marceljm
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
|
4 |
-
Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9.5
|
7 |
Stable tag: 4.9.5
|
@@ -97,7 +97,7 @@ Features:
|
|
97 |
|
98 |
= What happens if I have two featured images (internal and external)? =
|
99 |
|
100 |
-
* The external image has priority in this case and the internal image won't be shown.
|
101 |
|
102 |
= Which WooCommerce versions are supported by Featured Image from URL?
|
103 |
|
@@ -159,6 +159,9 @@ Features:
|
|
159 |
|
160 |
== Changelog ==
|
161 |
|
|
|
|
|
|
|
162 |
= 1.8.3 =
|
163 |
* Bug fix: use the first image as featured image.
|
164 |
|
@@ -366,6 +369,9 @@ was removed. To finish, a Premium version is now been presented.
|
|
366 |
|
367 |
== Upgrade Notice ==
|
368 |
|
|
|
|
|
|
|
369 |
= 1.8.3 =
|
370 |
* Bug fix: use the first image as featured image.
|
371 |
|
1 |
=== Plugin Name ===
|
2 |
Contributors: marceljm
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
|
4 |
+
Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, priority
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9.5
|
7 |
Stable tag: 4.9.5
|
97 |
|
98 |
= What happens if I have two featured images (internal and external)? =
|
99 |
|
100 |
+
* The external image has priority in this case and the internal image won't be shown. However you can revert the priority in the plugin settings.
|
101 |
|
102 |
= Which WooCommerce versions are supported by Featured Image from URL?
|
103 |
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 1.8.4 =
|
163 |
+
* Allows to prioritize the internal image rather than the external one, if both exist.
|
164 |
+
|
165 |
= 1.8.3 =
|
166 |
* Bug fix: use the first image as featured image.
|
167 |
|
369 |
|
370 |
== Upgrade Notice ==
|
371 |
|
372 |
+
= 1.8.4 =
|
373 |
+
* Allows to prioritize the internal image rather than the external one, if both exist.
|
374 |
+
|
375 |
= 1.8.3 =
|
376 |
* Bug fix: use the first image as featured image.
|
377 |
|