Version Description
- Now it's possible to use an external image as Featured Image of your WooCommerce Product Category. Then an "External Featured Image" box will be shown when you create/edit a Product Category. Depending on your theme, you must enable "WooCommerce Full Integration" on Featured Image From URL settings.
=
Download this release
Release Info
Developer | marceljm |
Plugin | ![]() |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- admin/category.php +32 -0
- admin/html/category.html +53 -0
- admin/html/css/category.css +20 -0
- admin/html/js/category.js +26 -0
- admin/html/menu.html +57 -57
- admin/menu.php +21 -17
- featured-image-from-url.php +4 -1
- includes/html/backlink.html +2 -3
- includes/thumbnail_category.php +42 -0
- readme.txt +15 -5
- scripts/disableWoocommerce.sh +14 -1
- scripts/enableWoocommerce.sh +12 -1
admin/category.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_action('product_cat_edit_form_fields','fifu_show_category_box');
|
4 |
+
add_action('product_cat_add_form_fields','fifu_show_category_box');
|
5 |
+
|
6 |
+
function fifu_show_category_box($term) {
|
7 |
+
$margin = 'margin-top:10px;';
|
8 |
+
$width = 'width:100%;';
|
9 |
+
$height = 'height:266px;';
|
10 |
+
$align = 'text-align:left;';
|
11 |
+
|
12 |
+
$url = get_term_meta($term->term_id, 'fifu_image_url', true);
|
13 |
+
$alt = get_term_meta($term->term_id, 'fifu_image_alt', true);
|
14 |
+
|
15 |
+
if ($url)
|
16 |
+
$show_url = $show_button = 'display:none;';
|
17 |
+
else
|
18 |
+
$show_alt = $show_image = $show_link = 'display:none;';
|
19 |
+
|
20 |
+
include 'html/category.html';
|
21 |
+
}
|
22 |
+
|
23 |
+
add_action( 'edited_product_cat', 'fifu_save_category_image_properties', 10, 2 );
|
24 |
+
add_action( 'create_product_cat', 'fifu_save_category_image_properties', 10, 2 );
|
25 |
+
|
26 |
+
function fifu_save_category_image_properties($term_id) {
|
27 |
+
if (isset($_POST['fifu_input_url']))
|
28 |
+
update_term_meta($term_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
|
29 |
+
|
30 |
+
if (isset($_POST['fifu_input_alt']))
|
31 |
+
update_term_meta($term_id, 'fifu_image_alt', wp_strip_all_tags($_POST['fifu_input_alt']));
|
32 |
+
}
|
admin/html/category.html
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script><?php include 'js/category.js' ?></script>
|
2 |
+
|
3 |
+
<style><?php include 'css/category.css' ?></style>
|
4 |
+
|
5 |
+
<tr>
|
6 |
+
<th>External Featured Image</th>
|
7 |
+
<td>
|
8 |
+
<div class="box">
|
9 |
+
|
10 |
+
<!-- show alt field, image and remove link if URL was already provided -->
|
11 |
+
|
12 |
+
<input id="fifu_input_alt"
|
13 |
+
type="text"
|
14 |
+
name="fifu_input_alt"
|
15 |
+
placeholder="alt attribute (optional)"
|
16 |
+
value="<?php echo $alt; ?>"
|
17 |
+
style="<?php echo $width, $margin, $show_alt ?>" />
|
18 |
+
|
19 |
+
<p/>
|
20 |
+
|
21 |
+
<div id="fifu_image"
|
22 |
+
style="<?php echo $height, $margin, $show_image ?>
|
23 |
+
background:url('<?php echo $url; ?>') no-repeat center center;
|
24 |
+
background-size:cover;" >
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<p/>
|
28 |
+
|
29 |
+
<a id="fifu_link"
|
30 |
+
href="#"
|
31 |
+
onClick="removeImage();"
|
32 |
+
style="<?php echo $show_link ?>" >Remove external featured image</a>
|
33 |
+
|
34 |
+
<!-- show URL field and preview button if URL was not provided yet -->
|
35 |
+
|
36 |
+
<input id="fifu_input_url"
|
37 |
+
type="text"
|
38 |
+
name="fifu_input_url"
|
39 |
+
placeholder="URL"
|
40 |
+
value="<?php echo $url; ?>"
|
41 |
+
style="<?php echo $width, $margin, $show_url ?>" />
|
42 |
+
|
43 |
+
<a id="fifu_button"
|
44 |
+
class="button"
|
45 |
+
onClick="previewImage();"
|
46 |
+
style="<?php echo $align, $margin, $show_button ?>" >Preview</a>
|
47 |
+
|
48 |
+
</div>
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
|
52 |
+
<br/>
|
53 |
+
|
admin/html/css/category.css
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.box {
|
2 |
+
margin: 20px 0 0;
|
3 |
+
background: #fff;
|
4 |
+
border: 1px solid #dbdbdb;
|
5 |
+
padding: 20px;
|
6 |
+
width: 92%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.greybox {
|
10 |
+
margin: 10px 0 0;
|
11 |
+
background: #f9f9f9;
|
12 |
+
border: 1px solid #dbdbdb;
|
13 |
+
padding: 20px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.greybox p {
|
17 |
+
font-style: italic;
|
18 |
+
color: #999;
|
19 |
+
}
|
20 |
+
|
admin/html/js/category.js
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function removeImage() {
|
2 |
+
jQuery("#fifu_input_alt").hide();
|
3 |
+
jQuery("#fifu_image").hide();
|
4 |
+
jQuery("#fifu_link").hide();
|
5 |
+
|
6 |
+
jQuery("#fifu_input_alt").val("");
|
7 |
+
jQuery("#fifu_input_url").val("");
|
8 |
+
|
9 |
+
jQuery("#fifu_input_url").show();
|
10 |
+
jQuery("#fifu_button").show();
|
11 |
+
}
|
12 |
+
|
13 |
+
function previewImage() {
|
14 |
+
var $url = jQuery("#fifu_input_url").val();
|
15 |
+
|
16 |
+
if ($url) {
|
17 |
+
jQuery("#fifu_input_url").hide();
|
18 |
+
jQuery("#fifu_button").hide();
|
19 |
+
|
20 |
+
jQuery("#fifu_image").css('background-image', "url('" + $url + "')");
|
21 |
+
|
22 |
+
jQuery("#fifu_input_alt").show();
|
23 |
+
jQuery("#fifu_image").show();
|
24 |
+
jQuery("#fifu_link").show();
|
25 |
+
}
|
26 |
+
}
|
admin/html/menu.html
CHANGED
@@ -16,41 +16,41 @@
|
|
16 |
|
17 |
</div>
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
|
55 |
<div class="box">
|
56 |
|
@@ -92,22 +92,22 @@
|
|
92 |
|
93 |
</div>
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
|
112 |
<input id="fifu_input_cpt0" type="text" name="fifu_input_cpt0" style="width:130px" value="<?php echo $array_cpt[0]; ?>">
|
113 |
<input id="fifu_input_cpt1" type="text" name="fifu_input_cpt1" style="width:130px" value="<?php echo $array_cpt[1]; ?>">
|
@@ -116,45 +116,45 @@
|
|
116 |
<input id="fifu_input_cpt4" type="text" name="fifu_input_cpt4" style="width:130px" value="<?php echo $array_cpt[4]; ?>">
|
117 |
|
118 |
<input type="submit" value="Submit" >
|
119 |
-
|
120 |
|
121 |
-
|
122 |
|
123 |
-
|
124 |
|
125 |
-
|
126 |
|
127 |
-
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
132 |
|
133 |
-
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
|
157 |
-
|
158 |
|
159 |
<div class="box">
|
160 |
|
@@ -162,7 +162,7 @@
|
|
162 |
|
163 |
<div class="greybox">
|
164 |
|
165 |
-
<p>Do you mind if I put a invisible and not clickable backlink in your page/post/product? Just Googlebot will be able to see
|
166 |
|
167 |
</div>
|
168 |
|
16 |
|
17 |
</div>
|
18 |
|
19 |
+
<div class="box">
|
20 |
|
21 |
+
<h2>Make a Donation</h2>
|
22 |
|
23 |
+
<div class="greybox">
|
24 |
|
25 |
+
<p>Featured Image From URL is completely free and without advertising. To help me to continue updating and improving it, please consider making a donation by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG" target="_blank">PayPal</a>. Thank you!</p>
|
26 |
|
27 |
+
</div>
|
28 |
|
29 |
+
</div>
|
30 |
|
31 |
+
<div class="box">
|
32 |
|
33 |
+
<h2>Give This Plugin a 5-Star Rating</h2>
|
34 |
|
35 |
+
<div class="greybox">
|
36 |
|
37 |
+
<p>Do you really love Featured Image From URL? So give your <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">rating</a> right now. It's very important for me and WordPress community too.</p>
|
38 |
|
39 |
+
</div>
|
40 |
|
41 |
+
</div>
|
42 |
|
43 |
+
<div class="box">
|
44 |
|
45 |
+
<h2>Suggestions For Improvement</h2>
|
46 |
|
47 |
+
<div class="greybox">
|
48 |
|
49 |
+
<p>Constructive suggestions for improvement are always welcome. Just send an email to <a href="mailto:contact@marceljm.com">contact@marceljm.com</a>. Your request can be available in next version.</p>
|
50 |
|
51 |
+
</div>
|
52 |
|
53 |
+
</div>
|
54 |
|
55 |
<div class="box">
|
56 |
|
92 |
|
93 |
</div>
|
94 |
|
95 |
+
<div class="box">
|
96 |
|
97 |
+
<h2>Custom Post Types</h2>
|
98 |
|
99 |
+
<div class="greybox">
|
100 |
|
101 |
+
<p>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 5 inputs here.</p>
|
102 |
|
103 |
+
</div>
|
104 |
|
105 |
+
<p/>
|
106 |
|
107 |
+
<form
|
108 |
+
id="fifu_form_cpt"
|
109 |
+
action="javascript:void(0)"
|
110 |
+
method="post">
|
111 |
|
112 |
<input id="fifu_input_cpt0" type="text" name="fifu_input_cpt0" style="width:130px" value="<?php echo $array_cpt[0]; ?>">
|
113 |
<input id="fifu_input_cpt1" type="text" name="fifu_input_cpt1" style="width:130px" value="<?php echo $array_cpt[1]; ?>">
|
116 |
<input id="fifu_input_cpt4" type="text" name="fifu_input_cpt4" style="width:130px" value="<?php echo $array_cpt[4]; ?>">
|
117 |
|
118 |
<input type="submit" value="Submit" >
|
119 |
+
</form>
|
120 |
|
121 |
+
</div>
|
122 |
|
123 |
+
<div class="box">
|
124 |
|
125 |
+
<h2>Featured Image in Content</h2>
|
126 |
|
127 |
+
<div class="greybox">
|
128 |
|
129 |
+
<p>Some themes don't show the Featured Image in the content. If it is your case and you would like to show the Featured Image there, just enable the toggle. The Featured Image will appear at the beginning of the content, before any text or image.</p>
|
130 |
|
131 |
+
</div>
|
132 |
|
133 |
+
<p/>
|
134 |
|
135 |
+
<form
|
136 |
+
id="fifu_form_content"
|
137 |
+
action="javascript:void(0)"
|
138 |
+
method="post">
|
139 |
|
140 |
+
<input
|
141 |
+
type="image"
|
142 |
+
href="javascript:void(0)"
|
143 |
+
id="fifu_toggle_content"
|
144 |
+
onclick="invert('content')"
|
145 |
+
name="fifu_toggle_content"
|
146 |
+
class="<?php echo $enable_content; ?>"
|
147 |
+
value=" "
|
148 |
+
style="<?php echo $show_content_button; ?>">
|
149 |
|
150 |
+
<input
|
151 |
+
type="hidden"
|
152 |
+
id="fifu_input_content"
|
153 |
+
name="fifu_input_content"
|
154 |
+
value="" >
|
155 |
+
</form>
|
156 |
|
157 |
+
</div>
|
158 |
|
159 |
<div class="box">
|
160 |
|
162 |
|
163 |
<div class="greybox">
|
164 |
|
165 |
+
<p>Do you mind if I put a invisible and not clickable backlink in your page/post/product? Just Googlebot will be able to see that. This may seem very simple but increases the plugin page position on Google without interfering with your site layout, performance or SEO : )</p>
|
166 |
|
167 |
</div>
|
168 |
|
admin/menu.php
CHANGED
@@ -23,8 +23,8 @@ function fifu_get_menu_html() {
|
|
23 |
$enable_content = get_option('fifu_content');
|
24 |
|
25 |
$array_cpt = array();
|
26 |
-
|
27 |
-
|
28 |
|
29 |
$show_woocommerce_button = "display:block";
|
30 |
$output = shell_exec('uname -s');
|
@@ -55,14 +55,14 @@ function fifu_get_menu_settings() {
|
|
55 |
}
|
56 |
|
57 |
function fifu_get_setting($type) {
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
}
|
67 |
|
68 |
function fifu_update_menu_options() {
|
@@ -70,7 +70,7 @@ function fifu_update_menu_options() {
|
|
70 |
fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
|
71 |
fifu_update_option('fifu_input_content', 'fifu_content');
|
72 |
|
73 |
-
|
74 |
fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
|
75 |
}
|
76 |
|
@@ -86,10 +86,14 @@ function fifu_update_option($input, $type) {
|
|
86 |
}
|
87 |
|
88 |
function fifu_script_woocommerce() {
|
89 |
-
if (get_option('fifu_woocommerce') == 'toggleon')
|
90 |
-
$
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
95 |
}
|
23 |
$enable_content = get_option('fifu_content');
|
24 |
|
25 |
$array_cpt = array();
|
26 |
+
for ($x = 0; $x <= 4; $x++)
|
27 |
+
$array_cpt[$x] = get_option('fifu_cpt' . $x);
|
28 |
|
29 |
$show_woocommerce_button = "display:block";
|
30 |
$output = shell_exec('uname -s');
|
55 |
}
|
56 |
|
57 |
function fifu_get_setting($type) {
|
58 |
+
register_setting('settings-group', $type);
|
59 |
+
|
60 |
+
if (!get_option($type)) {
|
61 |
+
if (strpos($type, "cpt") !== false)
|
62 |
+
update_option($type, '');
|
63 |
+
else
|
64 |
+
update_option($type, 'toggleoff');
|
65 |
+
}
|
66 |
}
|
67 |
|
68 |
function fifu_update_menu_options() {
|
70 |
fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
|
71 |
fifu_update_option('fifu_input_content', 'fifu_content');
|
72 |
|
73 |
+
for ($x = 0; $x <= 4; $x++)
|
74 |
fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
|
75 |
}
|
76 |
|
86 |
}
|
87 |
|
88 |
function fifu_script_woocommerce() {
|
89 |
+
if (get_option('fifu_woocommerce') == 'toggleon') {
|
90 |
+
$command1 = "echo " . get_template_directory() . " > ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
|
91 |
+
$command2 = "sh ../wp-content/plugins/featured-image-from-url/scripts/enableWoocommerce.sh";
|
92 |
+
}
|
93 |
+
else {
|
94 |
+
$command1 = "sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh";
|
95 |
+
$command2 = "rm ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
|
96 |
+
}
|
97 |
+
shell_exec($command1);
|
98 |
+
shell_exec($command2);
|
99 |
}
|
featured-image-from-url.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* Plugin Name: Featured Image From URL
|
5 |
* Description: Allows to use an external image as Featured Image of your post, page or Custom Post Type, such as WooCommerce Product (supports Product Gallery also).
|
6 |
-
* Version: 1.1.
|
7 |
* Author: Marcel Jacques Machado
|
8 |
* Author URI: http://marceljm.com
|
9 |
*/
|
@@ -13,10 +13,13 @@ define('FIFU_INCLUDES_DIR', FIFU_PLUGIN_DIR . '/includes');
|
|
13 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . '/admin');
|
14 |
|
15 |
require_once( FIFU_INCLUDES_DIR . '/thumbnail.php' );
|
|
|
|
|
16 |
if (is_admin()) {
|
17 |
require_once( FIFU_ADMIN_DIR . '/meta-box.php' );
|
18 |
require_once( FIFU_ADMIN_DIR . '/menu.php' );
|
19 |
require_once( FIFU_ADMIN_DIR . '/column.php' );
|
|
|
20 |
}
|
21 |
|
22 |
register_deactivation_hook( __FILE__, 'fifu_desactivate' );
|
3 |
/*
|
4 |
* Plugin Name: Featured Image From URL
|
5 |
* Description: Allows to use an external image as Featured Image of your post, page or Custom Post Type, such as WooCommerce Product (supports Product Gallery also).
|
6 |
+
* Version: 1.1.5
|
7 |
* Author: Marcel Jacques Machado
|
8 |
* Author URI: http://marceljm.com
|
9 |
*/
|
13 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . '/admin');
|
14 |
|
15 |
require_once( FIFU_INCLUDES_DIR . '/thumbnail.php' );
|
16 |
+
require_once( FIFU_INCLUDES_DIR . '/thumbnail_category.php' );
|
17 |
+
|
18 |
if (is_admin()) {
|
19 |
require_once( FIFU_ADMIN_DIR . '/meta-box.php' );
|
20 |
require_once( FIFU_ADMIN_DIR . '/menu.php' );
|
21 |
require_once( FIFU_ADMIN_DIR . '/column.php' );
|
22 |
+
require_once( FIFU_ADMIN_DIR . '/category.php' );
|
23 |
}
|
24 |
|
25 |
register_deactivation_hook( __FILE__, 'fifu_desactivate' );
|
includes/html/backlink.html
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<a
|
2 |
-
|
3 |
-
href="http://marceljm.com/"
|
4 |
style="display:none;">
|
5 |
-
Featured Image From URL
|
6 |
</a>
|
1 |
<a
|
2 |
+
href="https://wordpress.org/plugins/featured-image-from-url/"
|
|
|
3 |
style="display:none;">
|
4 |
+
Generated by Featured Image From URL (WordPress plugin).
|
5 |
</a>
|
includes/thumbnail_category.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
add_filter( 'woocommerce_before_main_content', 'fifu_category_show_image', 30);
|
4 |
+
|
5 |
+
function fifu_category_show_image() {
|
6 |
+
$image_url = fifu_get_image_url();
|
7 |
+
$image_alt = fifu_get_image_alt();
|
8 |
+
|
9 |
+
if ($image_url) {
|
10 |
+
$html = fifu_category_get_html($image_url, $image_alt);
|
11 |
+
if (get_option('fifu_backlink') == 'toggleon')
|
12 |
+
include 'html/backlink.html';
|
13 |
+
}
|
14 |
+
echo $html;
|
15 |
+
}
|
16 |
+
|
17 |
+
add_filter('wp_head', 'fifu_category_image_social_tags');
|
18 |
+
|
19 |
+
function fifu_category_image_social_tags() {
|
20 |
+
$image_url = fifu_get_image_url();
|
21 |
+
if ($image_url)
|
22 |
+
include 'html/social.html';
|
23 |
+
}
|
24 |
+
|
25 |
+
function fifu_get_image_url () {
|
26 |
+
$term_id = fifu_get_term_id();
|
27 |
+
return get_term_meta($term_id, 'fifu_image_url', true);
|
28 |
+
}
|
29 |
+
|
30 |
+
function fifu_get_image_alt() {
|
31 |
+
$term_id = fifu_get_term_id();
|
32 |
+
return get_term_meta($term_id, 'fifu_image_alt', true);
|
33 |
+
}
|
34 |
+
|
35 |
+
function fifu_get_term_id() {
|
36 |
+
global $wp_query;
|
37 |
+
return $wp_query->queried_object->term_id;
|
38 |
+
}
|
39 |
+
|
40 |
+
function fifu_category_get_html($image_url, $image_alt) {
|
41 |
+
return sprintf('<!-- Generated by Featured Image from URL (Wordpress plugin) --> <img src="%s" alt="%s"></img>', $image_url, $image_alt);
|
42 |
+
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
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, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.4.
|
7 |
-
Stable tag: 4.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -14,7 +14,7 @@ Allows to use an external image as Featured Image of your post, page or Custom P
|
|
14 |
|
15 |
Allows you to use an external image (from Flickr, Picasa, Amazon S3, anywhere etc) as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product.
|
16 |
|
17 |
-
It's also possible to use external images in the WooCommerce Product Gallery (since your site is hosted on a Linux server).
|
18 |
|
19 |
Besides that, when you access "All Posts", "All Pages" or "Products" in admin menu, the Featured Images (internal or external) are shown in a new column.
|
20 |
|
@@ -89,6 +89,10 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
|
|
89 |
|
90 |
* 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.
|
91 |
|
|
|
|
|
|
|
|
|
92 |
== Screenshots ==
|
93 |
|
94 |
1. This plugin allows you to use an external image as Featured Image of your pages. Just fill the URL field with the image address and click on preview button.
|
@@ -159,7 +163,10 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
|
|
159 |
* If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
|
160 |
|
161 |
= 1.1.4 =
|
162 |
-
* Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define until 5 Custom Post Types
|
|
|
|
|
|
|
163 |
|
164 |
== Upgrade Notice ==
|
165 |
|
@@ -186,3 +193,6 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
|
|
186 |
|
187 |
= 1.1.4 =
|
188 |
* Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define for now until 5 Custom Post Types.
|
|
|
|
|
|
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, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.4.2
|
7 |
+
Stable tag: 4.4.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
Allows you to use an external image (from Flickr, Picasa, Amazon S3, anywhere etc) as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product.
|
16 |
|
17 |
+
It's also possible to use external images in the WooCommerce Product Gallery (since your site is hosted on a Linux server) and WooCommerce Product Category.
|
18 |
|
19 |
Besides that, when you access "All Posts", "All Pages" or "Products" in admin menu, the Featured Images (internal or external) are shown in a new column.
|
20 |
|
89 |
|
90 |
* 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.
|
91 |
|
92 |
+
= How to show an external featured image on WooCommerce Product Category page? =
|
93 |
+
|
94 |
+
* An "External Featured Image" box will be shown when you create/edit a Product Category. Depending on your theme, you must enable "WooCommerce Full Integration" on Featured Image From URL settings.
|
95 |
+
|
96 |
== Screenshots ==
|
97 |
|
98 |
1. This plugin allows you to use an external image as Featured Image of your pages. Just fill the URL field with the image address and click on preview button.
|
163 |
* If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
|
164 |
|
165 |
= 1.1.4 =
|
166 |
+
* Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define for now until 5 Custom Post Types.
|
167 |
+
|
168 |
+
= 1.1.5 =
|
169 |
+
* Now it's possible to use an external image as Featured Image of your WooCommerce Product Category. Then an "External Featured Image" box will be shown when you create/edit a Product Category. Depending on your theme, you must enable "WooCommerce Full Integration" on Featured Image From URL settings.
|
170 |
|
171 |
== Upgrade Notice ==
|
172 |
|
193 |
|
194 |
= 1.1.4 =
|
195 |
* Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define for now until 5 Custom Post Types.
|
196 |
+
|
197 |
+
= 1.1.5 =
|
198 |
+
* Now it's possible to use an external image as Featured Image of your WooCommerce Product Category. Then an "External Featured Image" box will be shown when you create/edit a Product Category. Depending on your theme, you must enable "WooCommerce Full Integration" on Featured Image From URL settings.
|
scripts/disableWoocommerce.sh
CHANGED
@@ -1,16 +1,28 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
dir='../wp-content/plugins/woocommerce/templates/single-product/'
|
|
|
4 |
|
5 |
restoreProductImage()
|
6 |
{
|
7 |
file=$dir'product-image.php'
|
8 |
-
|
9 |
}
|
10 |
|
11 |
restoreProductThumbnails()
|
12 |
{
|
13 |
file=$dir'product-thumbnails.php'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
mv $file'.bkp' $file
|
15 |
}
|
16 |
|
@@ -18,6 +30,7 @@ restore()
|
|
18 |
{
|
19 |
restoreProductImage
|
20 |
restoreProductThumbnails
|
|
|
21 |
}
|
22 |
|
23 |
restore
|
1 |
#!/bin/bash
|
2 |
|
3 |
dir='../wp-content/plugins/woocommerce/templates/single-product/'
|
4 |
+
themeDir=`cat ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt`
|
5 |
|
6 |
restoreProductImage()
|
7 |
{
|
8 |
file=$dir'product-image.php'
|
9 |
+
overwrite
|
10 |
}
|
11 |
|
12 |
restoreProductThumbnails()
|
13 |
{
|
14 |
file=$dir'product-thumbnails.php'
|
15 |
+
overwrite
|
16 |
+
}
|
17 |
+
|
18 |
+
restoreCategory()
|
19 |
+
{
|
20 |
+
file=$themeDir'/woocommerce.php'
|
21 |
+
overwrite
|
22 |
+
}
|
23 |
+
|
24 |
+
overwrite()
|
25 |
+
{
|
26 |
mv $file'.bkp' $file
|
27 |
}
|
28 |
|
30 |
{
|
31 |
restoreProductImage
|
32 |
restoreProductThumbnails
|
33 |
+
restoreCategory
|
34 |
}
|
35 |
|
36 |
restore
|
scripts/enableWoocommerce.sh
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
dir='../wp-content/plugins/woocommerce/templates/single-product/'
|
|
|
4 |
|
5 |
featured_image()
|
6 |
{
|
@@ -37,9 +38,17 @@ gallery()
|
|
37 |
replace
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
replace()
|
41 |
{
|
42 |
-
integrated=`egrep "
|
43 |
if [[ ! $integrated ]]
|
44 |
then
|
45 |
backup
|
@@ -55,3 +64,5 @@ backup()
|
|
55 |
featured_image
|
56 |
|
57 |
gallery
|
|
|
|
1 |
#!/bin/bash
|
2 |
|
3 |
dir='../wp-content/plugins/woocommerce/templates/single-product/'
|
4 |
+
themeDir=`cat ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt`
|
5 |
|
6 |
featured_image()
|
7 |
{
|
38 |
replace
|
39 |
}
|
40 |
|
41 |
+
category()
|
42 |
+
{
|
43 |
+
file=$themeDir'/woocommerce.php'
|
44 |
+
old='woocommerce_content()'
|
45 |
+
new='fifu_category_show_image();woocommerce_content()'
|
46 |
+
replace
|
47 |
+
}
|
48 |
+
|
49 |
replace()
|
50 |
{
|
51 |
+
integrated=`egrep "fifu_" $file`
|
52 |
if [[ ! $integrated ]]
|
53 |
then
|
54 |
backup
|
64 |
featured_image
|
65 |
|
66 |
gallery
|
67 |
+
|
68 |
+
category
|