Featured Image From URL - Version 1.7.6

Version Description

  • Default external featured image.

=

Download this release

Release Info

Developer marceljm
Plugin Icon 128x128 Featured Image From URL
Version 1.7.6
Comparing to
See all releases

Code changes from version 1.7.5 to 1.7.6

admin/column.php CHANGED
@@ -27,7 +27,7 @@ function fifu_cat_column_content($internal_image, $column, $term_id) {
27
 
28
  function fifu_column_content($column, $post_id) {
29
  if ($column == 'featured_image') {
30
- $url = get_post_meta($post_id, 'fifu_image_url', true);
31
  if ($url == '')
32
  $url = wp_get_attachment_url(get_post_thumbnail_id());
33
  echo sprintf('<img src="%s" height="%s"/>', $url, get_option('fifu_column_height'));
27
 
28
  function fifu_column_content($column, $post_id) {
29
  if ($column == 'featured_image') {
30
+ $url = fifu_main_image_url($post_id);
31
  if ($url == '')
32
  $url = wp_get_attachment_url(get_post_thumbnail_id());
33
  echo sprintf('<img src="%s" height="%s"/>', $url, get_option('fifu_column_height'));
admin/html/menu.html CHANGED
@@ -136,6 +136,41 @@
136
  </form>
137
  </div>
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  <div class="box">
140
  <h2>Fake Internal Featured Image</h2>
141
  <div class="greybox" id="grad1">
@@ -693,6 +728,7 @@
693
  <div>
694
  You just need to get one URL (Square 75). Use that to fill the External Featured Image field of your post, page or product. The plugin will handle this URL to provide the image in different sizes.<br><br>
695
  <img src="https://c1.staticflickr.com/1/745/31593837206_8e081be749_z_d.jpg" style="width:100%"/>
 
696
  <img src="https://c1.staticflickr.com/1/223/30820834393_f869fcff49_z_d.jpg" style="width:100%"/>
697
  </div>
698
  <h3>Choose the maximum image size for each screen</h3>
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)"
160
+ method="post">
161
+
162
+ <input id="fifu_input_default_url"
163
+ type="text"
164
+ name="fifu_input_default_url"
165
+ style="width:675px"
166
+ value="<?php echo $default_url; ?>">
167
+
168
+ <input type="submit"
169
+ value="Submit" >
170
+ </form>
171
+
172
+ </div>
173
+
174
  <div class="box">
175
  <h2>Fake Internal Featured Image</h2>
176
  <div class="greybox" id="grad1">
728
  <div>
729
  You just need to get one URL (Square 75). Use that to fill the External Featured Image field of your post, page or product. The plugin will handle this URL to provide the image in different sizes.<br><br>
730
  <img src="https://c1.staticflickr.com/1/745/31593837206_8e081be749_z_d.jpg" style="width:100%"/>
731
+ <br><br>
732
  <img src="https://c1.staticflickr.com/1/223/30820834393_f869fcff49_z_d.jpg" style="width:100%"/>
733
  </div>
734
  <h3>Choose the maximum image size for each screen</h3>
admin/html/meta-box.html CHANGED
@@ -50,8 +50,10 @@
50
  <div style="<?php echo $show_news?>">
51
  <br>
52
  <hr>
 
 
53
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #336699; color: black;
54
- background-color: #eee; border-radius: 25px 5px;">New: compatibility improvements. External Product Gallery works with the most famous themes now.</p><!-- (28% of <a href="https://goo.gl/forms/TxLdhwXTqsuO5BHg2">votes</a>)</p>-->
55
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #cc6600; color: black;
56
  background-color: #eee; border-radius: 25px 5px;">New: <a href="admin.php?page=featured-image-from-url#top">check compatibility</a> between FIFU Premium and your theme.</p>
57
  <center>
50
  <div style="<?php echo $show_news?>">
51
  <br>
52
  <hr>
53
+ <p style="font-size: 12px; padding: 5px; border-left: 6px solid #248709; color: black;
54
+ background-color: #eee; border-radius: 25px 5px;">New: define a <a href="admin.php?page=featured-image-from-url#default">default external featured image</a> to be shown when there is no featured image. (15% of <a href="https://goo.gl/forms/TxLdhwXTqsuO5BHg2">votes</a>)</p>
55
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #336699; color: black;
56
+ background-color: #eee; border-radius: 25px 5px;">New: compatibility improvements. External Product Gallery works with the most famous themes now.</p>
57
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #cc6600; color: black;
58
  background-color: #eee; border-radius: 25px 5px;">New: <a href="admin.php?page=featured-image-from-url#top">check compatibility</a> between FIFU Premium and your theme.</p>
59
  <center>
admin/menu.php CHANGED
@@ -17,6 +17,7 @@ function fifu_get_menu_html() {
17
  $enable_lazy = get_option('fifu_lazy');
18
  $enable_content = get_option('fifu_content');
19
  $enable_fake = get_option('fifu_fake');
 
20
  $enable_wc_lbox = get_option('fifu_wc_lbox');
21
  $enable_wc_zoom = get_option('fifu_wc_zoom');
22
  $enable_hide_page = get_option('fifu_hide_page');
@@ -45,6 +46,7 @@ function fifu_get_menu_settings() {
45
  fifu_get_setting('fifu_lazy');
46
  fifu_get_setting('fifu_content');
47
  fifu_get_setting('fifu_fake');
 
48
  fifu_get_setting('fifu_wc_lbox');
49
  fifu_get_setting('fifu_wc_zoom');
50
  fifu_get_setting('fifu_hide_page');
@@ -62,7 +64,7 @@ function fifu_get_setting($type) {
62
  register_setting('settings-group', $type);
63
 
64
  if (!get_option($type)) {
65
- if (strpos($type, "cpt") !== false)
66
  update_option($type, '');
67
  else if (strpos($type, "fifu_column_height") !== false)
68
  update_option($type, "64");
@@ -78,6 +80,7 @@ function fifu_update_menu_options() {
78
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
79
  fifu_update_option('fifu_input_content', 'fifu_content');
80
  fifu_update_option('fifu_input_fake', 'fifu_fake');
 
81
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
82
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
83
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
17
  $enable_lazy = get_option('fifu_lazy');
18
  $enable_content = get_option('fifu_content');
19
  $enable_fake = get_option('fifu_fake');
20
+ $default_url = get_option('fifu_default_url');
21
  $enable_wc_lbox = get_option('fifu_wc_lbox');
22
  $enable_wc_zoom = get_option('fifu_wc_zoom');
23
  $enable_hide_page = get_option('fifu_hide_page');
46
  fifu_get_setting('fifu_lazy');
47
  fifu_get_setting('fifu_content');
48
  fifu_get_setting('fifu_fake');
49
+ fifu_get_setting('fifu_default_url');
50
  fifu_get_setting('fifu_wc_lbox');
51
  fifu_get_setting('fifu_wc_zoom');
52
  fifu_get_setting('fifu_hide_page');
64
  register_setting('settings-group', $type);
65
 
66
  if (!get_option($type)) {
67
+ if (strpos($type, "cpt") !== false || strpos($type, "default") !== false)
68
  update_option($type, '');
69
  else if (strpos($type, "fifu_column_height") !== false)
70
  update_option($type, "64");
80
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
81
  fifu_update_option('fifu_input_content', 'fifu_content');
82
  fifu_update_option('fifu_input_fake', 'fifu_fake');
83
+ fifu_update_option('fifu_input_default_url', 'fifu_default_url');
84
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
85
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
86
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
featured-image-from-url.php CHANGED
@@ -2,10 +2,11 @@
2
 
3
  /*
4
  * Plugin Name: Featured Image From URL
 
5
  * 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.
6
- * Version: 1.7.5
7
  * Author: Marcel Jacques Machado
8
- * Author URI: http://featuredimagefromurl.com/
9
  */
10
 
11
  define('FIFU_PLUGIN_DIR', plugin_dir_path(__FILE__));
2
 
3
  /*
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.7.6
8
  * Author: Marcel Jacques Machado
9
+ * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
11
 
12
  define('FIFU_PLUGIN_DIR', plugin_dir_path(__FILE__));
includes/thumbnail.php CHANGED
@@ -13,7 +13,7 @@ function fifu_add_js() {
13
 
14
  function fifu_add_social_tags() {
15
  $post_id = get_the_ID();
16
- $url = get_post_meta($post_id, 'fifu_image_url', true);
17
  $title = get_the_title($post_id);
18
  $description = wp_strip_all_tags(get_post_field('post_content', $post_id));
19
 
@@ -38,11 +38,11 @@ add_action('the_post', 'fifu_choose');
38
  function fifu_choose($post) {
39
  $post_id = $post->ID;
40
 
41
- $image_url = get_post_meta($post_id, 'fifu_image_url', true);
42
 
43
  $featured_image = get_post_meta($post_id, '_thumbnail_id', true);
44
 
45
- if ($image_url) {
46
  if (!$featured_image)
47
  update_post_meta($post_id, '_thumbnail_id', -1);
48
  }
@@ -86,7 +86,7 @@ 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 = get_post_meta(get_the_ID(), 'fifu_image_url', true);
90
  if ($url)
91
  $att_url = $url;
92
  }
@@ -97,7 +97,7 @@ add_filter('wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 1
97
 
98
  function fifu_replace_attachment_image_src($image, $att_id) {
99
  if ($att_id == get_post_thumbnail_id(get_the_ID())) {
100
- $url = get_post_meta(get_the_ID(), 'fifu_image_url', true);
101
  if ($url) {
102
  return array(
103
  $url,
@@ -120,6 +120,19 @@ function fifu_genesis_image($args, $var1, $var2, $src) {
120
  return $src ? fifu_replace($args, get_the_ID()) : $args;
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  function fifu_lazy_url($url) {
124
  if (get_option('fifu_lazy') != 'toggleon' || is_ajax_call())
125
  return 'src="' . $url . '"';
13
 
14
  function fifu_add_social_tags() {
15
  $post_id = get_the_ID();
16
+ $url = fifu_main_image_url($post_id);
17
  $title = get_the_title($post_id);
18
  $description = wp_strip_all_tags(get_post_field('post_content', $post_id));
19
 
38
  function fifu_choose($post) {
39
  $post_id = $post->ID;
40
 
41
+ $image_url = fifu_main_image_url($post_id);
42
 
43
  $featured_image = get_post_meta($post_id, '_thumbnail_id', true);
44
 
45
+ if ($image_url || !empty(get_option('fifu_default_url'))) {
46
  if (!$featured_image)
47
  update_post_meta($post_id, '_thumbnail_id', -1);
48
  }
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)
91
  $att_url = $url;
92
  }
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) {
102
  return array(
103
  $url,
120
  return $src ? fifu_replace($args, get_the_ID()) : $args;
121
  }
122
 
123
+ function fifu_main_image_url($post_id) {
124
+ $url = get_post_meta($post_id, 'fifu_image_url', true);
125
+
126
+ if (!$url && fifu_no_internal_image($post_id))
127
+ $url = get_option('fifu_default_url');
128
+
129
+ return $url;
130
+ }
131
+
132
+ function fifu_no_internal_image($post_id) {
133
+ return get_post_meta($post_id, '_thumbnail_id', true) == -1;
134
+ }
135
+
136
  function fifu_lazy_url($url) {
137
  if (get_option('fifu_lazy') != 'toggleon' || is_ajax_call())
138
  return 'src="' . $url . '"';
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
5
  Requires at least: 4.0
6
  Tested up to: 4.9.4
7
  Stable tag: 4.9.4
@@ -334,6 +334,9 @@ was removed. To finish, a Premium version is now been presented.
334
  = 1.7.5 =
335
  * Check compatibility between the user theme and Premium version features.
336
 
 
 
 
337
  == Upgrade Notice ==
338
 
339
  = 1.0 =
@@ -515,4 +518,7 @@ was removed. To finish, a Premium version is now been presented.
515
  * Bug fix: Instagram URLs. Scripts removed: no more support to WooCommerce 2.
516
 
517
  = 1.7.5 =
518
- * Check compatibility between the user theme and Premium version features.
 
 
 
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
5
  Requires at least: 4.0
6
  Tested up to: 4.9.4
7
  Stable tag: 4.9.4
334
  = 1.7.5 =
335
  * Check compatibility between the user theme and Premium version features.
336
 
337
+ = 1.7.6 =
338
+ * Default external featured image.
339
+
340
  == Upgrade Notice ==
341
 
342
  = 1.0 =
518
  * Bug fix: Instagram URLs. Scripts removed: no more support to WooCommerce 2.
519
 
520
  = 1.7.5 =
521
+ * Check compatibility between the user theme and Premium version features.
522
+
523
+ = 1.7.6 =
524
+ * Default external featured image.