Featured Image From URL - Version 2.2.3

Version Description

  • Improvement: URL field is added to all Custom Post Types automatically now.
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.2.3

admin/column.php CHANGED
@@ -36,7 +36,7 @@ function fifu_column_content($column, $post_id) {
36
  }
37
 
38
  function fifu_column_custom_post_type() {
39
- for ($i = 0; $i < 10; $i++)
40
- add_filter('manage_edit-' . get_option('fifu_cpt' . $i) . '_columns', 'fifu_column_head');
41
  }
42
 
36
  }
37
 
38
  function fifu_column_custom_post_type() {
39
+ foreach (fifu_get_post_types() as $post_type)
40
+ add_filter('manage_edit-' . $post_type . '_columns', 'fifu_column_head');
41
  }
42
 
admin/html/menu.html CHANGED
@@ -13,7 +13,6 @@
13
  <li><a href="#tabs-d">Help</a></li>
14
  <li><a href="#tabs-k">Admin Area</a></li>
15
  <li><a href="#tabs-b">Auto Set</a></li>
16
- <li><a href="#tabs-h">Custom Post Type</a></li>
17
  <li><a href="#tabs-g">Featured Image</a></li>
18
  <li><a href="#tabs-j">Metadata</a></li>
19
  <li><a href="#tabs-i">Performance</a></li>
@@ -315,33 +314,6 @@
315
  </table>
316
  </div>
317
  </div>
318
- <div id="tabs-h">
319
- <div class="box">
320
- <h2>Custom Post Types</h2>
321
- <div class="greybox">
322
- Featured Image from URL is preconfigured to work with only one Custom Post Type (WooCommerce Product). But you also can use this plugin with other ones. For that, you just need to know the correct Custom Post Type names and fill the fields below. Please, let me know if you need more than 10 inputs here.
323
- </div>
324
- <br>
325
-
326
- <form
327
- id="fifu_form_cpt"
328
- action="javascript:void(0)"
329
- method="post">
330
- <input id="fifu_input_cpt0" type="text" name="fifu_input_cpt0" style="width:130px" value="<?php echo $array_cpt[0]; ?>">
331
- <input id="fifu_input_cpt1" type="text" name="fifu_input_cpt1" style="width:130px" value="<?php echo $array_cpt[1]; ?>">
332
- <input id="fifu_input_cpt2" type="text" name="fifu_input_cpt2" style="width:130px" value="<?php echo $array_cpt[2]; ?>">
333
- <input id="fifu_input_cpt3" type="text" name="fifu_input_cpt3" style="width:130px" value="<?php echo $array_cpt[3]; ?>">
334
- <input id="fifu_input_cpt4" type="text" name="fifu_input_cpt4" style="width:130px" value="<?php echo $array_cpt[4]; ?>">
335
- <br/>
336
- <input id="fifu_input_cpt5" type="text" name="fifu_input_cpt5" style="width:130px" value="<?php echo $array_cpt[5]; ?>">
337
- <input id="fifu_input_cpt6" type="text" name="fifu_input_cpt6" style="width:130px" value="<?php echo $array_cpt[6]; ?>">
338
- <input id="fifu_input_cpt7" type="text" name="fifu_input_cpt7" style="width:130px" value="<?php echo $array_cpt[7]; ?>">
339
- <input id="fifu_input_cpt8" type="text" name="fifu_input_cpt8" style="width:130px" value="<?php echo $array_cpt[8]; ?>">
340
- <input id="fifu_input_cpt9" type="text" name="fifu_input_cpt9" style="width:130px" value="<?php echo $array_cpt[9]; ?>">
341
- <input type="submit" value="Submit" >
342
- </form>
343
- </div>
344
- </div>
345
  <div id="tabs-g">
346
  <div class="box">
347
  <h2>Crop images to the same size</h2>
@@ -1839,7 +1811,7 @@
1839
  <ul>
1840
  <li><a href="#tabs-3">Importing products...</a></li>
1841
  <li><a href="#tabs-1">Custom Fields</a></li>
1842
- <li><a href="#tabs-2">Premium Custom Fields</a></li>
1843
  </ul>
1844
  <div id="tabs-1">
1845
 
@@ -2003,16 +1975,6 @@ fifu_auto_alt:<?php echo $enable_auto_alt ?>;
2003
  fifu_column_height:<?php echo $column_height ?>;
2004
  fifu_content:<?php echo $enable_content ?>;
2005
  fifu_content_page:<?php echo $enable_content_page ?>;
2006
- fifu_cpt0:<?php echo $array_cpt[0] ?>;
2007
- fifu_cpt1:<?php echo $array_cpt[1] ?>;
2008
- fifu_cpt2:<?php echo $array_cpt[2] ?>;
2009
- fifu_cpt3:<?php echo $array_cpt[3] ?>;
2010
- fifu_cpt4:<?php echo $array_cpt[4] ?>;
2011
- fifu_cpt5:<?php echo $array_cpt[5] ?>;
2012
- fifu_cpt6:<?php echo $array_cpt[6] ?>;
2013
- fifu_cpt7:<?php echo $array_cpt[7] ?>;
2014
- fifu_cpt8:<?php echo $array_cpt[8] ?>;
2015
- fifu_cpt9:<?php echo $array_cpt[9] ?>;
2016
  fifu_css:<?php echo $css_style ?>;
2017
  fifu_data_clean:<?php echo $enable_data_clean ?>;
2018
  fifu_data_generation:<?php echo $enable_data_generation ?>;
13
  <li><a href="#tabs-d">Help</a></li>
14
  <li><a href="#tabs-k">Admin Area</a></li>
15
  <li><a href="#tabs-b">Auto Set</a></li>
 
16
  <li><a href="#tabs-g">Featured Image</a></li>
17
  <li><a href="#tabs-j">Metadata</a></li>
18
  <li><a href="#tabs-i">Performance</a></li>
314
  </table>
315
  </div>
316
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  <div id="tabs-g">
318
  <div class="box">
319
  <h2>Crop images to the same size</h2>
1811
  <ul>
1812
  <li><a href="#tabs-3">Importing products...</a></li>
1813
  <li><a href="#tabs-1">Custom Fields</a></li>
1814
+ <li><a href="#tabs-2">Custom Fields (Premium)</a></li>
1815
  </ul>
1816
  <div id="tabs-1">
1817
 
1975
  fifu_column_height:<?php echo $column_height ?>;
1976
  fifu_content:<?php echo $enable_content ?>;
1977
  fifu_content_page:<?php echo $enable_content_page ?>;
 
 
 
 
 
 
 
 
 
 
1978
  fifu_css:<?php echo $css_style ?>;
1979
  fifu_data_clean:<?php echo $enable_data_clean ?>;
1980
  fifu_data_generation:<?php echo $enable_data_generation ?>;
admin/menu.php CHANGED
@@ -38,10 +38,6 @@ function fifu_get_menu_html() {
38
  $enable_data_generation = get_option('fifu_data_generation');
39
  $enable_data_clean = get_option('fifu_data_clean');
40
 
41
- $array_cpt = array();
42
- for ($x = 0; $x < 10; $x++)
43
- $array_cpt[$x] = get_option('fifu_cpt' . $x);
44
-
45
  include 'html/menu.html';
46
 
47
  fifu_update_menu_options();
@@ -103,16 +99,13 @@ function fifu_get_menu_settings() {
103
  fifu_get_setting('fifu_auto_alt');
104
  fifu_get_setting('fifu_data_generation');
105
  fifu_get_setting('fifu_data_clean');
106
-
107
- for ($x = 0; $x < 10; $x++)
108
- fifu_get_setting('fifu_cpt' . $x);
109
  }
110
 
111
  function fifu_get_setting($type) {
112
  register_setting('settings-group', $type);
113
 
114
  if (!get_option($type)) {
115
- if (strpos($type, "cpt") !== false || strpos($type, "fifu_default_width") !== false || strpos($type, "fifu_default_url") !== false || strpos($type, "css") !== false)
116
  update_option($type, '');
117
  else if (strpos($type, "fifu_column_height") !== false)
118
  update_option($type, "64");
@@ -147,9 +140,6 @@ function fifu_update_menu_options() {
147
  fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
148
  fifu_update_option('fifu_input_data_generation', 'fifu_data_generation');
149
  fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
150
-
151
- for ($x = 0; $x < 10; $x++)
152
- fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
153
  }
154
 
155
  function fifu_update_option($input, $type) {
38
  $enable_data_generation = get_option('fifu_data_generation');
39
  $enable_data_clean = get_option('fifu_data_clean');
40
 
 
 
 
 
41
  include 'html/menu.html';
42
 
43
  fifu_update_menu_options();
99
  fifu_get_setting('fifu_auto_alt');
100
  fifu_get_setting('fifu_data_generation');
101
  fifu_get_setting('fifu_data_clean');
 
 
 
102
  }
103
 
104
  function fifu_get_setting($type) {
105
  register_setting('settings-group', $type);
106
 
107
  if (!get_option($type)) {
108
+ if (strpos($type, "fifu_default_width") !== false || strpos($type, "fifu_default_url") !== false || strpos($type, "css") !== false)
109
  update_option($type, '');
110
  else if (strpos($type, "fifu_column_height") !== false)
111
  update_option($type, "64");
140
  fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
141
  fifu_update_option('fifu_input_data_generation', 'fifu_data_generation');
142
  fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
 
 
 
143
  }
144
 
145
  function fifu_update_option($input, $type) {
admin/meta-box.php CHANGED
@@ -3,21 +3,7 @@
3
  add_action('add_meta_boxes', 'fifu_insert_meta_box');
4
 
5
  function fifu_insert_meta_box() {
6
- $post_types = array(
7
- 'post',
8
- 'page',
9
- 'product',
10
- get_option('fifu_cpt0'),
11
- get_option('fifu_cpt1'),
12
- get_option('fifu_cpt2'),
13
- get_option('fifu_cpt3'),
14
- get_option('fifu_cpt4'),
15
- get_option('fifu_cpt5'),
16
- get_option('fifu_cpt6'),
17
- get_option('fifu_cpt7'),
18
- get_option('fifu_cpt8'),
19
- get_option('fifu_cpt9'),
20
- );
21
 
22
  foreach ($post_types as $post_type) {
23
  if ($post_type == 'product') {
3
  add_action('add_meta_boxes', 'fifu_insert_meta_box');
4
 
5
  function fifu_insert_meta_box() {
6
+ $post_types = fifu_get_post_types();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  foreach ($post_types as $post_type) {
9
  if ($post_type == 'product') {
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://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: 2.2.2
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: https://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: 2.2.3
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/util.php CHANGED
@@ -24,3 +24,12 @@ function fifu_is_off($option) {
24
  return get_option($option) == 'toggleoff';
25
  }
26
 
 
 
 
 
 
 
 
 
 
24
  return get_option($option) == 'toggleoff';
25
  }
26
 
27
+ function fifu_get_post_types() {
28
+ $arr = array();
29
+ foreach (get_post_types() as $post_type) {
30
+ if (post_type_supports($post_type, 'thumbnail'))
31
+ array_push($arr, $post_type);
32
+ }
33
+ return $arr;
34
+ }
35
+
readme.txt CHANGED
@@ -113,10 +113,6 @@ Features:
113
 
114
  * There is a toggle (on/off) in Featured Image from URL settings. This functionality was added to attend some themes that didn't show the Featured Image before the content of Posts, Pages or Products.
115
 
116
- = How to use Featured Image from URL with my Custom Post Types? =
117
-
118
- * There are some text fields in Featured Image from URL settings. For now you can define there until 5 Custom Post Types. Just type the correct names and click on Submit button.
119
-
120
  == Screenshots ==
121
 
122
  1. Just fill the URL field with the image address and click on preview button.
@@ -161,6 +157,9 @@ Features:
161
 
162
  == Changelog ==
163
 
 
 
 
164
  = 2.2.2 =
165
  * Bug fix: support dialog (click here button).
166
 
@@ -497,6 +496,9 @@ was removed. To finish, a Premium version is now been presented.
497
 
498
  == Upgrade Notice ==
499
 
 
 
 
500
  = 2.2.2 =
501
  * Bug fix: support dialog (click here button).
502
 
113
 
114
  * There is a toggle (on/off) in Featured Image from URL settings. This functionality was added to attend some themes that didn't show the Featured Image before the content of Posts, Pages or Products.
115
 
 
 
 
 
116
  == Screenshots ==
117
 
118
  1. Just fill the URL field with the image address and click on preview button.
157
 
158
  == Changelog ==
159
 
160
+ = 2.2.3 =
161
+ * Improvement: URL field is added to all Custom Post Types automatically now.
162
+
163
  = 2.2.2 =
164
  * Bug fix: support dialog (click here button).
165
 
496
 
497
  == Upgrade Notice ==
498
 
499
+ = 2.2.3 =
500
+ * Improvement: URL field is added to all Custom Post Types automatically now.
501
+
502
  = 2.2.2 =
503
  * Bug fix: support dialog (click here button).
504