Categories Images - Version 2.5.4

Version Description

  • Fix compatibility with the latest Wordpress version
Download this release

Release Info

Developer elzahlan
Plugin Icon 128x128 Categories Images
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

categories-images.php CHANGED
@@ -1,357 +1,363 @@
1
- <?php
2
- /**
3
- * Plugin Name: Categories Images
4
- * Plugin URI: http://zahlan.net/blog/2012/06/categories-images/
5
- * Description: Categories Images Plugin allow you to add an image to category or any custom term.
6
- * Author: Muhammad Said El Zahlan
7
- * Version: 2.5.3
8
- * Author URI: http://zahlan.net/
9
- * Domain Path: /languages
10
- * Text Domain: categories-images
11
- */
12
- ?>
13
- <?php
14
- if (!defined('Z_PLUGIN_URL'))
15
- define('Z_PLUGIN_URL', untrailingslashit(plugins_url('', __FILE__)));
16
-
17
- define('Z_IMAGE_PLACEHOLDER', Z_PLUGIN_URL."/images/placeholder.png");
18
-
19
- // l10n
20
- load_plugin_textdomain('categories-images', FALSE, 'categories-images/languages');
21
-
22
- add_action('admin_init', 'z_init');
23
- function z_init() {
24
- $z_taxonomies = get_taxonomies();
25
- if (is_array($z_taxonomies)) {
26
- $zci_options = get_option('zci_options');
27
- if (empty($zci_options['excluded_taxonomies']))
28
- $zci_options['excluded_taxonomies'] = array();
29
-
30
- foreach ($z_taxonomies as $z_taxonomy) {
31
- if (in_array($z_taxonomy, $zci_options['excluded_taxonomies']))
32
- continue;
33
- add_action($z_taxonomy.'_add_form_fields', 'z_add_texonomy_field');
34
- add_action($z_taxonomy.'_edit_form_fields', 'z_edit_texonomy_field');
35
- add_filter( 'manage_edit-' . $z_taxonomy . '_columns', 'z_taxonomy_columns' );
36
- add_filter( 'manage_' . $z_taxonomy . '_custom_column', 'z_taxonomy_column', 10, 3 );
37
- }
38
- }
39
- }
40
-
41
- function z_add_style() {
42
- echo '<style type="text/css" media="screen">
43
- th.column-thumb {width:60px;}
44
- .form-field img.taxonomy-image {border:1px solid #eee;max-width:300px;max-height:300px;}
45
- .inline-edit-row fieldset .thumb label span.title {width:48px;height:48px;border:1px solid #eee;display:inline-block;}
46
- .column-thumb span {width:48px;height:48px;border:1px solid #eee;display:inline-block;}
47
- .inline-edit-row fieldset .thumb img,.column-thumb img {width:48px;height:48px;}
48
- </style>';
49
- }
50
-
51
- // add image field in add form
52
- function z_add_texonomy_field() {
53
- if (get_bloginfo('version') >= 3.5)
54
- wp_enqueue_media();
55
- else {
56
- wp_enqueue_style('thickbox');
57
- wp_enqueue_script('thickbox');
58
- }
59
-
60
- echo '<div class="form-field">
61
- <label for="taxonomy_image">' . __('Image', 'categories-images') . '</label>
62
- <input type="text" name="taxonomy_image" id="taxonomy_image" value="" />
63
- <br/>
64
- <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
65
- </div>'.z_script();
66
- }
67
-
68
- // add image field in edit form
69
- function z_edit_texonomy_field($taxonomy) {
70
- if (get_bloginfo('version') >= 3.5)
71
- wp_enqueue_media();
72
- else {
73
- wp_enqueue_style('thickbox');
74
- wp_enqueue_script('thickbox');
75
- }
76
-
77
- if (z_taxonomy_image_url( $taxonomy->term_id, NULL, TRUE ) == Z_IMAGE_PLACEHOLDER)
78
- $image_url = "";
79
- else
80
- $image_url = z_taxonomy_image_url( $taxonomy->term_id, NULL, TRUE );
81
- echo '<tr class="form-field">
82
- <th scope="row" valign="top"><label for="taxonomy_image">' . __('Image', 'categories-images') . '</label></th>
83
- <td><img class="taxonomy-image" src="' . z_taxonomy_image_url( $taxonomy->term_id, 'medium', TRUE ) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="'.$image_url.'" /><br />
84
- <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
85
- <button class="z_remove_image_button button">' . __('Remove image', 'categories-images') . '</button>
86
- </td>
87
- </tr>'.z_script();
88
- }
89
-
90
- // upload using wordpress upload
91
- function z_script() {
92
- return '<script type="text/javascript">
93
- jQuery(document).ready(function($) {
94
- var wordpress_ver = "'.get_bloginfo("version").'", upload_button;
95
- $(".z_upload_image_button").click(function(event) {
96
- upload_button = $(this);
97
- var frame;
98
- if (wordpress_ver >= "3.5") {
99
- event.preventDefault();
100
- if (frame) {
101
- frame.open();
102
- return;
103
- }
104
- frame = wp.media();
105
- frame.on( "select", function() {
106
- // Grab the selected attachment.
107
- var attachment = frame.state().get("selection").first();
108
- frame.close();
109
- if (upload_button.parent().prev().children().hasClass("tax_list")) {
110
- upload_button.parent().prev().children().val(attachment.attributes.url);
111
- upload_button.parent().prev().prev().children().attr("src", attachment.attributes.url);
112
- }
113
- else
114
- $("#taxonomy_image").val(attachment.attributes.url);
115
- });
116
- frame.open();
117
- }
118
- else {
119
- tb_show("", "media-upload.php?type=image&amp;TB_iframe=true");
120
- return false;
121
- }
122
- });
123
-
124
- $(".z_remove_image_button").click(function() {
125
- $(".taxonomy-image").attr("src", "'.Z_IMAGE_PLACEHOLDER.'");
126
- $("#taxonomy_image").val("");
127
- $(this).parent().siblings(".title").children("img").attr("src","' . Z_IMAGE_PLACEHOLDER . '");
128
- $(".inline-edit-col :input[name=\'taxonomy_image\']").val("");
129
- return false;
130
- });
131
-
132
- if (wordpress_ver < "3.5") {
133
- window.send_to_editor = function(html) {
134
- imgurl = $("img",html).attr("src");
135
- if (upload_button.parent().prev().children().hasClass("tax_list")) {
136
- upload_button.parent().prev().children().val(imgurl);
137
- upload_button.parent().prev().prev().children().attr("src", imgurl);
138
- }
139
- else
140
- $("#taxonomy_image").val(imgurl);
141
- tb_remove();
142
- }
143
- }
144
-
145
- $(".editinline").click(function() {
146
- var tax_id = $(this).parents("tr").attr("id").substr(4);
147
- var thumb = $("#tag-"+tax_id+" .thumb img").attr("src");
148
-
149
- if (thumb != "' . Z_IMAGE_PLACEHOLDER . '") {
150
- $(".inline-edit-col :input[name=\'taxonomy_image\']").val(thumb);
151
- } else {
152
- $(".inline-edit-col :input[name=\'taxonomy_image\']").val("");
153
- }
154
-
155
- $(".inline-edit-col .title img").attr("src",thumb);
156
- });
157
- });
158
- </script>';
159
- }
160
-
161
- // save our taxonomy image while edit or save term
162
- add_action('edit_term','z_save_taxonomy_image');
163
- add_action('create_term','z_save_taxonomy_image');
164
- function z_save_taxonomy_image($term_id) {
165
- if(isset($_POST['taxonomy_image']))
166
- update_option('z_taxonomy_image'.$term_id, $_POST['taxonomy_image'], NULL);
167
- }
168
-
169
- // get attachment ID by image url
170
- function z_get_attachment_id_by_url($image_src) {
171
- global $wpdb;
172
- $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid = %s", $image_src);
173
- $id = $wpdb->get_var($query);
174
- return (!empty($id)) ? $id : NULL;
175
- }
176
-
177
- // get taxonomy image url for the given term_id (Place holder image by default)
178
- function z_taxonomy_image_url($term_id = NULL, $size = 'full', $return_placeholder = FALSE) {
179
- if (!$term_id) {
180
- if (is_category())
181
- $term_id = get_query_var('cat');
182
- elseif (is_tag())
183
- $term_id = get_query_var('tag_id');
184
- elseif (is_tax()) {
185
- $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
186
- $term_id = $current_term->term_id;
187
- }
188
- }
189
-
190
- $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
191
- if(!empty($taxonomy_image_url)) {
192
- $attachment_id = z_get_attachment_id_by_url($taxonomy_image_url);
193
- if(!empty($attachment_id)) {
194
- $taxonomy_image_url = wp_get_attachment_image_src($attachment_id, $size);
195
- $taxonomy_image_url = $taxonomy_image_url[0];
196
- }
197
- }
198
-
199
- if ($return_placeholder)
200
- return ($taxonomy_image_url != '') ? $taxonomy_image_url : Z_IMAGE_PLACEHOLDER;
201
- else
202
- return $taxonomy_image_url;
203
- }
204
-
205
- function z_quick_edit_custom_box($column_name, $screen, $name) {
206
- if ($column_name == 'thumb')
207
- echo '<fieldset>
208
- <div class="thumb inline-edit-col">
209
- <label>
210
- <span class="title"><img src="" alt="Thumbnail"/></span>
211
- <span class="input-text-wrap"><input type="text" name="taxonomy_image" value="" class="tax_list" /></span>
212
- <span class="input-text-wrap">
213
- <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
214
- <button class="z_remove_image_button button">' . __('Remove image', 'categories-images') . '</button>
215
- </span>
216
- </label>
217
- </div>
218
- </fieldset>';
219
- }
220
-
221
- /**
222
- * Thumbnail column added to category admin.
223
- *
224
- * @access public
225
- * @param mixed $columns
226
- * @return void
227
- */
228
- function z_taxonomy_columns( $columns ) {
229
- $new_columns = array();
230
- $new_columns['cb'] = $columns['cb'];
231
- $new_columns['thumb'] = __('Image', 'categories-images');
232
-
233
- unset( $columns['cb'] );
234
-
235
- return array_merge( $new_columns, $columns );
236
- }
237
-
238
- /**
239
- * Thumbnail column value added to category admin.
240
- *
241
- * @access public
242
- * @param mixed $columns
243
- * @param mixed $column
244
- * @param mixed $id
245
- * @return void
246
- */
247
- function z_taxonomy_column( $columns, $column, $id ) {
248
- if ( $column == 'thumb' )
249
- $columns = '<span><img src="' . z_taxonomy_image_url($id, 'thumbnail', TRUE) . '" alt="' . __('Thumbnail', 'categories-images') . '" class="wp-post-image" /></span>';
250
-
251
- return $columns;
252
- }
253
-
254
- // Change 'insert into post' to 'use this image'
255
- function z_change_insert_button_text($safe_text, $text) {
256
- return str_replace("Insert into Post", "Use this image", $text);
257
- }
258
-
259
- // Style the image in category list
260
- if ( strpos( $_SERVER['SCRIPT_NAME'], 'edit-tags.php' ) > 0 ) {
261
- add_action( 'admin_head', 'z_add_style' );
262
- add_action('quick_edit_custom_box', 'z_quick_edit_custom_box', 10, 3);
263
- add_filter("attribute_escape", "z_change_insert_button_text", 10, 2);
264
- }
265
-
266
- // New menu submenu for plugin options in Settings menu
267
- add_action('admin_menu', 'z_options_menu');
268
- function z_options_menu() {
269
- add_options_page(__('Categories Images settings', 'categories-images'), __('Categories Images', 'categories-images'), 'manage_options', 'zci-options', 'zci_options');
270
- add_action('admin_init', 'z_register_settings');
271
- }
272
-
273
- // Register plugin settings
274
- function z_register_settings() {
275
- register_setting('zci_options', 'zci_options', 'z_options_validate');
276
- add_settings_section('zci_settings', __('Categories Images settings', 'categories-images'), 'z_section_text', 'zci-options');
277
- add_settings_field('z_excluded_taxonomies', __('Excluded Taxonomies', 'categories-images'), 'z_excluded_taxonomies', 'zci-options', 'zci_settings');
278
- }
279
-
280
- // Settings section description
281
- function z_section_text() {
282
- echo '<p>'.__('Please select the taxonomies you want to exclude it from Categories Images plugin', 'categories-images').'</p>';
283
- }
284
-
285
- // Excluded taxonomies checkboxs
286
- function z_excluded_taxonomies() {
287
- $options = get_option('zci_options');
288
- $disabled_taxonomies = array('nav_menu', 'link_category', 'post_format');
289
- foreach (get_taxonomies() as $tax) : if (in_array($tax, $disabled_taxonomies)) continue; ?>
290
- <input type="checkbox" name="zci_options[excluded_taxonomies][<?php echo $tax ?>]" value="<?php echo $tax ?>" <?php checked(isset($options['excluded_taxonomies'][$tax])); ?> /> <?php echo $tax ;?><br />
291
- <?php endforeach;
292
- }
293
-
294
- // Validating options
295
- function z_options_validate($input) {
296
- return $input;
297
- }
298
-
299
- // Plugin option page
300
- function zci_options() {
301
- if (!current_user_can('manage_options'))
302
- wp_die(__( 'You do not have sufficient permissions to access this page.', 'categories-images'));
303
- $options = get_option('zci_options');
304
- ?>
305
- <div class="wrap">
306
- <?php screen_icon(); ?>
307
- <h2><?php _e('Categories Images', 'categories-images'); ?></h2>
308
- <form method="post" action="options.php">
309
- <?php settings_fields('zci_options'); ?>
310
- <?php do_settings_sections('zci-options'); ?>
311
- <?php submit_button(); ?>
312
- </form>
313
- </div>
314
- <?php
315
- }
316
-
317
- // display taxonomy image for the given term_id
318
- function z_taxonomy_image($term_id = NULL, $size = 'full', $attr = NULL, $echo = TRUE) {
319
- if (!$term_id) {
320
- if (is_category())
321
- $term_id = get_query_var('cat');
322
- elseif (is_tag())
323
- $term_id = get_query_var('tag_id');
324
- elseif (is_tax()) {
325
- $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
326
- $term_id = $current_term->term_id;
327
- }
328
- }
329
-
330
- $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
331
- if(!empty($taxonomy_image_url)) {
332
- $attachment_id = z_get_attachment_id_by_url($taxonomy_image_url);
333
- if(!empty($attachment_id))
334
- $taxonomy_image = wp_get_attachment_image($attachment_id, $size, FALSE, $attr);
335
- else {
336
- $image_attr = '';
337
- if(is_array($attr)) {
338
- if(!empty($attr['class']))
339
- $image_attr .= ' class="'.$attr['class'].'" ';
340
- if(!empty($attr['alt']))
341
- $image_attr .= ' alt="'.$attr['alt'].'" ';
342
- if(!empty($attr['width']))
343
- $image_attr .= ' width="'.$attr['width'].'" ';
344
- if(!empty($attr['height']))
345
- $image_attr .= ' height="'.$attr['height'].'" ';
346
- if(!empty($attr['title']))
347
- $image_attr .= ' title="'.$attr['title'].'" ';
348
- }
349
- $taxonomy_image = '<img src="'.$taxonomy_image_url.'" '.$image_attr.'/>';
350
- }
351
- }
352
-
353
- if ($echo)
354
- echo $taxonomy_image;
355
- else
356
- return $taxonomy_image;
 
 
 
 
 
 
357
  }
1
+ <?php
2
+ /**
3
+ * Plugin Name: Categories Images
4
+ * Plugin URI: http://zahlan.net/blog/2012/06/categories-images/
5
+ * Description: Categories Images Plugin allow you to add an image to category or any custom term.
6
+ * Author: Muhammad Said El Zahlan
7
+ * Version: 2.5.4
8
+ * Author URI: http://zahlan.net/
9
+ * Domain Path: /languages
10
+ * Text Domain: categories-images
11
+ */
12
+
13
+ if (!defined('Z_PLUGIN_URL'))
14
+ define('Z_PLUGIN_URL', untrailingslashit(plugins_url('', __FILE__)));
15
+
16
+ define('Z_IMAGE_PLACEHOLDER', Z_PLUGIN_URL."/images/placeholder.png");
17
+
18
+ // l10n
19
+ load_plugin_textdomain('categories-images', FALSE, 'categories-images/languages');
20
+
21
+ add_action('admin_init', 'z_init');
22
+ function z_init() {
23
+ $z_taxonomies = get_taxonomies();
24
+ if (is_array($z_taxonomies)) {
25
+ $zci_options = get_option('zci_options');
26
+
27
+ if (!is_array($zci_options))
28
+ $zci_options = array();
29
+
30
+ if (empty($zci_options['excluded_taxonomies']))
31
+ $zci_options['excluded_taxonomies'] = array();
32
+
33
+ foreach ($z_taxonomies as $z_taxonomy) {
34
+ if (in_array($z_taxonomy, $zci_options['excluded_taxonomies']))
35
+ continue;
36
+ add_action($z_taxonomy.'_add_form_fields', 'z_add_texonomy_field');
37
+ add_action($z_taxonomy.'_edit_form_fields', 'z_edit_texonomy_field');
38
+ add_filter( 'manage_edit-' . $z_taxonomy . '_columns', 'z_taxonomy_columns' );
39
+ add_filter( 'manage_' . $z_taxonomy . '_custom_column', 'z_taxonomy_column', 10, 3 );
40
+ }
41
+ }
42
+ }
43
+
44
+ function z_add_style() {
45
+ echo '<style type="text/css" media="screen">
46
+ th.column-thumb {width:60px;}
47
+ .form-field img.taxonomy-image {border:1px solid #eee;max-width:300px;max-height:300px;}
48
+ .inline-edit-row fieldset .thumb label span.title {width:48px;height:48px;border:1px solid #eee;display:inline-block;}
49
+ .column-thumb span {width:48px;height:48px;border:1px solid #eee;display:inline-block;}
50
+ .inline-edit-row fieldset .thumb img,.column-thumb img {width:48px;height:48px;}
51
+ </style>';
52
+ }
53
+
54
+ // add image field in add form
55
+ function z_add_texonomy_field() {
56
+ if (get_bloginfo('version') >= 3.5)
57
+ wp_enqueue_media();
58
+ else {
59
+ wp_enqueue_style('thickbox');
60
+ wp_enqueue_script('thickbox');
61
+ }
62
+
63
+ echo '<div class="form-field">
64
+ <label for="taxonomy_image">' . __('Image', 'categories-images') . '</label>
65
+ <input type="text" name="taxonomy_image" id="taxonomy_image" value="" />
66
+ <br/>
67
+ <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
68
+ </div>'.z_script();
69
+ }
70
+
71
+ // add image field in edit form
72
+ function z_edit_texonomy_field($taxonomy) {
73
+ if (get_bloginfo('version') >= 3.5)
74
+ wp_enqueue_media();
75
+ else {
76
+ wp_enqueue_style('thickbox');
77
+ wp_enqueue_script('thickbox');
78
+ }
79
+
80
+ if (z_taxonomy_image_url( $taxonomy->term_id, NULL, TRUE ) == Z_IMAGE_PLACEHOLDER)
81
+ $image_url = "";
82
+ else
83
+ $image_url = z_taxonomy_image_url( $taxonomy->term_id, NULL, TRUE );
84
+ echo '<tr class="form-field">
85
+ <th scope="row" valign="top"><label for="taxonomy_image">' . __('Image', 'categories-images') . '</label></th>
86
+ <td><img class="taxonomy-image" src="' . z_taxonomy_image_url( $taxonomy->term_id, 'medium', TRUE ) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="'.$image_url.'" /><br />
87
+ <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
88
+ <button class="z_remove_image_button button">' . __('Remove image', 'categories-images') . '</button>
89
+ </td>
90
+ </tr>'.z_script();
91
+ }
92
+
93
+ // upload using wordpress upload
94
+ function z_script() {
95
+ return '<script type="text/javascript">
96
+ jQuery(document).ready(function($) {
97
+ var wordpress_ver = "'.get_bloginfo("version").'", upload_button;
98
+ $(".z_upload_image_button").click(function(event) {
99
+ upload_button = $(this);
100
+ var frame;
101
+ if (wordpress_ver >= "3.5") {
102
+ event.preventDefault();
103
+ if (frame) {
104
+ frame.open();
105
+ return;
106
+ }
107
+ frame = wp.media();
108
+ frame.on( "select", function() {
109
+ // Grab the selected attachment.
110
+ var attachment = frame.state().get("selection").first();
111
+ frame.close();
112
+ if (upload_button.parent().prev().children().hasClass("tax_list")) {
113
+ upload_button.parent().prev().children().val(attachment.attributes.url);
114
+ upload_button.parent().prev().prev().children().attr("src", attachment.attributes.url);
115
+ }
116
+ else
117
+ $("#taxonomy_image").val(attachment.attributes.url);
118
+ });
119
+ frame.open();
120
+ }
121
+ else {
122
+ tb_show("", "media-upload.php?type=image&amp;TB_iframe=true");
123
+ return false;
124
+ }
125
+ });
126
+
127
+ $(".z_remove_image_button").click(function() {
128
+ $(".taxonomy-image").attr("src", "'.Z_IMAGE_PLACEHOLDER.'");
129
+ $("#taxonomy_image").val("");
130
+ $(this).parent().siblings(".title").children("img").attr("src","' . Z_IMAGE_PLACEHOLDER . '");
131
+ $(".inline-edit-col :input[name=\'taxonomy_image\']").val("");
132
+ return false;
133
+ });
134
+
135
+ if (wordpress_ver < "3.5") {
136
+ window.send_to_editor = function(html) {
137
+ imgurl = $("img",html).attr("src");
138
+ if (upload_button.parent().prev().children().hasClass("tax_list")) {
139
+ upload_button.parent().prev().children().val(imgurl);
140
+ upload_button.parent().prev().prev().children().attr("src", imgurl);
141
+ }
142
+ else
143
+ $("#taxonomy_image").val(imgurl);
144
+ tb_remove();
145
+ }
146
+ }
147
+
148
+ $(".editinline").click(function() {
149
+ var tax_id = $(this).parents("tr").attr("id").substr(4);
150
+ var thumb = $("#tag-"+tax_id+" .thumb img").attr("src");
151
+
152
+ if (thumb != "' . Z_IMAGE_PLACEHOLDER . '") {
153
+ $(".inline-edit-col :input[name=\'taxonomy_image\']").val(thumb);
154
+ } else {
155
+ $(".inline-edit-col :input[name=\'taxonomy_image\']").val("");
156
+ }
157
+
158
+ $(".inline-edit-col .title img").attr("src",thumb);
159
+ });
160
+ });
161
+ </script>';
162
+ }
163
+
164
+ // save our taxonomy image while edit or save term
165
+ add_action('edit_term','z_save_taxonomy_image');
166
+ add_action('create_term','z_save_taxonomy_image');
167
+ function z_save_taxonomy_image($term_id) {
168
+ if(isset($_POST['taxonomy_image']))
169
+ update_option('z_taxonomy_image'.$term_id, $_POST['taxonomy_image'], NULL);
170
+ }
171
+
172
+ // get attachment ID by image url
173
+ function z_get_attachment_id_by_url($image_src) {
174
+ global $wpdb;
175
+ $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid = %s", $image_src);
176
+ $id = $wpdb->get_var($query);
177
+ return (!empty($id)) ? $id : NULL;
178
+ }
179
+
180
+ // get taxonomy image url for the given term_id (Place holder image by default)
181
+ function z_taxonomy_image_url($term_id = NULL, $size = 'full', $return_placeholder = FALSE) {
182
+ if (!$term_id) {
183
+ if (is_category())
184
+ $term_id = get_query_var('cat');
185
+ elseif (is_tag())
186
+ $term_id = get_query_var('tag_id');
187
+ elseif (is_tax()) {
188
+ $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
189
+ $term_id = $current_term->term_id;
190
+ }
191
+ }
192
+
193
+ $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
194
+ if(!empty($taxonomy_image_url)) {
195
+ $attachment_id = z_get_attachment_id_by_url($taxonomy_image_url);
196
+ if(!empty($attachment_id)) {
197
+ $taxonomy_image_url = wp_get_attachment_image_src($attachment_id, $size);
198
+ $taxonomy_image_url = $taxonomy_image_url[0];
199
+ }
200
+ }
201
+
202
+ if ($return_placeholder)
203
+ return ($taxonomy_image_url != '') ? $taxonomy_image_url : Z_IMAGE_PLACEHOLDER;
204
+ else
205
+ return $taxonomy_image_url;
206
+ }
207
+
208
+ function z_quick_edit_custom_box($column_name, $screen, $name) {
209
+ if ($column_name == 'thumb')
210
+ echo '<fieldset>
211
+ <div class="thumb inline-edit-col">
212
+ <label>
213
+ <span class="title"><img src="" alt="Thumbnail"/></span>
214
+ <span class="input-text-wrap"><input type="text" name="taxonomy_image" value="" class="tax_list" /></span>
215
+ <span class="input-text-wrap">
216
+ <button class="z_upload_image_button button">' . __('Upload/Add image', 'categories-images') . '</button>
217
+ <button class="z_remove_image_button button">' . __('Remove image', 'categories-images') . '</button>
218
+ </span>
219
+ </label>
220
+ </div>
221
+ </fieldset>';
222
+ }
223
+
224
+ /**
225
+ * Thumbnail column added to category admin.
226
+ *
227
+ * @access public
228
+ * @param mixed $columns
229
+ * @return void
230
+ */
231
+ function z_taxonomy_columns( $columns ) {
232
+ $new_columns = array();
233
+ $new_columns['cb'] = $columns['cb'];
234
+ $new_columns['thumb'] = __('Image', 'categories-images');
235
+
236
+ unset( $columns['cb'] );
237
+
238
+ return array_merge( $new_columns, $columns );
239
+ }
240
+
241
+ /**
242
+ * Thumbnail column value added to category admin.
243
+ *
244
+ * @access public
245
+ * @param mixed $columns
246
+ * @param mixed $column
247
+ * @param mixed $id
248
+ * @return void
249
+ */
250
+ function z_taxonomy_column( $columns, $column, $id ) {
251
+ if ( $column == 'thumb' )
252
+ $columns = '<span><img src="' . z_taxonomy_image_url($id, 'thumbnail', TRUE) . '" alt="' . __('Thumbnail', 'categories-images') . '" class="wp-post-image" /></span>';
253
+
254
+ return $columns;
255
+ }
256
+
257
+ // Change 'insert into post' to 'use this image'
258
+ function z_change_insert_button_text($safe_text, $text) {
259
+ return str_replace("Insert into Post", "Use this image", $text);
260
+ }
261
+
262
+ // Style the image in category list
263
+ if ( strpos( $_SERVER['SCRIPT_NAME'], 'edit-tags.php' ) > 0 ) {
264
+ add_action( 'admin_head', 'z_add_style' );
265
+ add_action('quick_edit_custom_box', 'z_quick_edit_custom_box', 10, 3);
266
+ add_filter("attribute_escape", "z_change_insert_button_text", 10, 2);
267
+ }
268
+
269
+ // New menu submenu for plugin options in Settings menu
270
+ add_action('admin_menu', 'z_options_menu');
271
+ function z_options_menu() {
272
+ add_options_page(__('Categories Images settings', 'categories-images'), __('Categories Images', 'categories-images'), 'manage_options', 'zci-options', 'zci_options');
273
+ add_action('admin_init', 'z_register_settings');
274
+ }
275
+
276
+ // Register plugin settings
277
+ function z_register_settings() {
278
+ register_setting('zci_options', 'zci_options', 'z_options_validate');
279
+ add_settings_section('zci_settings', __('Categories Images settings', 'categories-images'), 'z_section_text', 'zci-options');
280
+ add_settings_field('z_excluded_taxonomies', __('Excluded Taxonomies', 'categories-images'), 'z_excluded_taxonomies', 'zci-options', 'zci_settings');
281
+ }
282
+
283
+ // Settings section description
284
+ function z_section_text() {
285
+ echo '<p>'.__('Please select the taxonomies you want to exclude it from Categories Images plugin', 'categories-images').'</p>';
286
+ }
287
+
288
+ // Excluded taxonomies checkboxs
289
+ function z_excluded_taxonomies() {
290
+ $options = get_option('zci_options');
291
+ $disabled_taxonomies = array('nav_menu', 'link_category', 'post_format');
292
+ foreach (get_taxonomies() as $tax) : if (in_array($tax, $disabled_taxonomies)) continue; ?>
293
+ <input type="checkbox" name="zci_options[excluded_taxonomies][<?php echo $tax ?>]" value="<?php echo $tax ?>" <?php checked(isset($options['excluded_taxonomies'][$tax])); ?> /> <?php echo $tax ;?><br />
294
+ <?php endforeach;
295
+ }
296
+
297
+ // Validating options
298
+ function z_options_validate($input) {
299
+ return $input;
300
+ }
301
+
302
+ // Plugin option page
303
+ function zci_options() {
304
+ if (!current_user_can('manage_options'))
305
+ wp_die(__( 'You do not have sufficient permissions to access this page.', 'categories-images'));
306
+ $options = get_option('zci_options');
307
+ ?>
308
+ <div class="wrap">
309
+ <?php screen_icon(); ?>
310
+ <h2><?php _e('Categories Images', 'categories-images'); ?></h2>
311
+ <form method="post" action="options.php">
312
+ <?php settings_fields('zci_options'); ?>
313
+ <?php do_settings_sections('zci-options'); ?>
314
+ <?php submit_button(); ?>
315
+ </form>
316
+ </div>
317
+ <?php
318
+ }
319
+
320
+ // display taxonomy image for the given term_id
321
+ function z_taxonomy_image($term_id = NULL, $size = 'full', $attr = NULL, $echo = TRUE) {
322
+ if (!$term_id) {
323
+ if (is_category())
324
+ $term_id = get_query_var('cat');
325
+ elseif (is_tag())
326
+ $term_id = get_query_var('tag_id');
327
+ elseif (is_tax()) {
328
+ $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
329
+ $term_id = $current_term->term_id;
330
+ }
331
+ }
332
+
333
+ $taxonomy_image_url = get_option('z_taxonomy_image'.$term_id);
334
+ if(!empty($taxonomy_image_url)) {
335
+ $attachment_id = z_get_attachment_id_by_url($taxonomy_image_url);
336
+ if(!empty($attachment_id))
337
+ $taxonomy_image = wp_get_attachment_image($attachment_id, $size, FALSE, $attr);
338
+ else {
339
+ $image_attr = '';
340
+ if(is_array($attr)) {
341
+ if(!empty($attr['class']))
342
+ $image_attr .= ' class="'.$attr['class'].'" ';
343
+ if(!empty($attr['alt']))
344
+ $image_attr .= ' alt="'.$attr['alt'].'" ';
345
+ if(!empty($attr['width']))
346
+ $image_attr .= ' width="'.$attr['width'].'" ';
347
+ if(!empty($attr['height']))
348
+ $image_attr .= ' height="'.$attr['height'].'" ';
349
+ if(!empty($attr['title']))
350
+ $image_attr .= ' title="'.$attr['title'].'" ';
351
+ }
352
+ $taxonomy_image = '<img src="'.$taxonomy_image_url.'" '.$image_attr.'/>';
353
+ }
354
+ }
355
+ else{
356
+ $taxonomy_image = '';
357
+ }
358
+
359
+ if ($echo)
360
+ echo $taxonomy_image;
361
+ else
362
+ return $taxonomy_image;
363
  }
languages/categories-images-ca.po CHANGED
@@ -1,63 +1,63 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Categories Images\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: Wed Jun 10 2015 19:06:10 GMT+0200 (CEST)\n"
6
- "PO-Revision-Date: Wed Jun 10 2015 19:07:54 GMT+0200 (CEST)\n"
7
- "Last-Translator: dms3 <dms3@demomentsomtres.com>\n"
8
- "Language-Team: \n"
9
- "Language: Catalan\n"
10
- "Plural-Forms: nplurals=2; plural=n != 1\n"
11
- "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
- "Content-Transfer-Encoding: 8bit\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-SearchPath-0: ..\n"
17
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
18
- "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
19
- "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
20
- "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
21
- "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
22
- "X-Loco-Target-Locale: ca_ES\n"
23
- "X-Generator: Loco - https://localise.biz/"
24
-
25
- #: ../categories-images.php:59 ../categories-images.php:80 ../categories-images.
26
- #: php:227
27
- msgid "Image"
28
- msgstr "Imatge"
29
-
30
- #: ../categories-images.php:62 ../categories-images.php:82 ../categories-images.
31
- #: php:209
32
- msgid "Upload/Add image"
33
- msgstr "Puja/Afegeix imatge"
34
-
35
- #: ../categories-images.php:83 ../categories-images.php:210
36
- msgid "Remove image"
37
- msgstr "Elimina la imatge"
38
-
39
- #: ../categories-images.php:245
40
- msgid "Thumbnail"
41
- msgstr "Miniatura"
42
-
43
- #: ../categories-images.php:265 ../categories-images.php:272
44
- msgid "Categories Images settings"
45
- msgstr "Configuració d'Imatges de Categoria"
46
-
47
- #: ../categories-images.php:265 ../categories-images.php:303
48
- msgid "Categories Images"
49
- msgstr "Imatges de Categoria"
50
-
51
- #: ../categories-images.php:273
52
- msgid "Excluded Taxonomies"
53
- msgstr "Taxonomies excloses"
54
-
55
- #: ../categories-images.php:278
56
- msgid ""
57
- "Please select the taxonomies you want to exclude it from Categories Images "
58
- "plugin"
59
- msgstr "Escull les taxonomies que vulguis excloure d'aquesta extensió"
60
-
61
- #: ../categories-images.php:298
62
- msgid "You do not have sufficient permissions to access this page."
63
- msgstr "No tens permís per accedir a aquesta pàgina"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Categories Images\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: Wed Jun 10 2015 19:06:10 GMT+0200 (CEST)\n"
6
+ "PO-Revision-Date: Wed Jun 10 2015 19:07:54 GMT+0200 (CEST)\n"
7
+ "Last-Translator: dms3 <dms3@demomentsomtres.com>\n"
8
+ "Language-Team: \n"
9
+ "Language: Catalan\n"
10
+ "Plural-Forms: nplurals=2; plural=n != 1\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-Basepath: .\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
18
+ "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
19
+ "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
20
+ "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
21
+ "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
22
+ "X-Loco-Target-Locale: ca_ES\n"
23
+ "X-Generator: Loco - https://localise.biz/"
24
+
25
+ #: ../categories-images.php:59 ../categories-images.php:80 ../categories-images.
26
+ #: php:227
27
+ msgid "Image"
28
+ msgstr "Imatge"
29
+
30
+ #: ../categories-images.php:62 ../categories-images.php:82 ../categories-images.
31
+ #: php:209
32
+ msgid "Upload/Add image"
33
+ msgstr "Puja/Afegeix imatge"
34
+
35
+ #: ../categories-images.php:83 ../categories-images.php:210
36
+ msgid "Remove image"
37
+ msgstr "Elimina la imatge"
38
+
39
+ #: ../categories-images.php:245
40
+ msgid "Thumbnail"
41
+ msgstr "Miniatura"
42
+
43
+ #: ../categories-images.php:265 ../categories-images.php:272
44
+ msgid "Categories Images settings"
45
+ msgstr "Configuració d'Imatges de Categoria"
46
+
47
+ #: ../categories-images.php:265 ../categories-images.php:303
48
+ msgid "Categories Images"
49
+ msgstr "Imatges de Categoria"
50
+
51
+ #: ../categories-images.php:273
52
+ msgid "Excluded Taxonomies"
53
+ msgstr "Taxonomies excloses"
54
+
55
+ #: ../categories-images.php:278
56
+ msgid ""
57
+ "Please select the taxonomies you want to exclude it from Categories Images "
58
+ "plugin"
59
+ msgstr "Escull les taxonomies que vulguis excloure d'aquesta extensió"
60
+
61
+ #: ../categories-images.php:298
62
+ msgid "You do not have sufficient permissions to access this page."
63
+ msgstr "No tens permís per accedir a aquesta pàgina"
languages/categories-images-sv_SE.po CHANGED
@@ -1,85 +1,85 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Categories Images\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: Fri Dec 04 2015 14:03:51 GMT+0100 (CET)\n"
6
- "PO-Revision-Date: 2016-03-10 23:56+0200\n"
7
- "Last-Translator: Munamamad El Zahlan <zahlan@theplanet.com.eg>\n"
8
- "Language-Team: \n"
9
- "Language: sv\n"
10
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
11
- "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
- "Content-Transfer-Encoding: 8bit\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;__:1;"
17
- "_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;_x:1,2c;"
18
- "_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;esc_attr__:1;"
19
- "esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;esc_html_x:1,2c;"
20
- "comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
21
- "X-Loco-Target-Locale: sv_SE\n"
22
- "X-Generator: Poedit 1.7.5\n"
23
- "X-Poedit-SearchPath-0: ../../plugins/categories-images\n"
24
-
25
- #. Name of the plugin
26
- msgid "Categories Images"
27
- msgstr "Kategoribilder"
28
-
29
- #. URI of the plugin
30
- msgid "http://zahlan.net/blog/2012/06/categories-images"
31
- msgstr "http://zahlan.net/blog/2012/06/categories-images"
32
-
33
- #. Description of the plugin
34
- msgid ""
35
- "Categories Images Plugin allow you to add an image to category or any custom term."
36
- msgstr ""
37
- "Kategoribildtillägget låter dig lägga till en bild till kategori eller annan egen "
38
- "motsvarighet."
39
-
40
- #. Author of the plugin
41
- msgid "Muhammad Said El Zahlan"
42
- msgstr "Muhammad Said El Zahlan"
43
-
44
- #. Author URI of the plugin
45
- msgid "http://zahlan.net"
46
- msgstr "http://zahlan.net"
47
-
48
- #: ../../plugins/categories-images/categories-images.php:61 ../..
49
- #: plugins/categories-images/categories-images.php:82 ../../plugins/categories-
50
- #: images/categories-images.php:229
51
- msgid "Image"
52
- msgstr "Bild"
53
-
54
- #: ../../plugins/categories-images/categories-images.php:64 ../..
55
- #: plugins/categories-images/categories-images.php:84 ../../plugins/categories-
56
- #: images/categories-images.php:211
57
- msgid "Upload/Add image"
58
- msgstr "Ladda upp/Lägg till bild"
59
-
60
- #: ../../plugins/categories-images/categories-images.php:85 ../..
61
- #: plugins/categories-images/categories-images.php:212
62
- msgid "Remove image"
63
- msgstr "Ta bort bild"
64
-
65
- #: ../../plugins/categories-images/categories-images.php:247
66
- msgid "Thumbnail"
67
- msgstr "Tumnagel"
68
-
69
- #: ../../plugins/categories-images/categories-images.php:267 ../..
70
- #: plugins/categories-images/categories-images.php:274
71
- msgid "Categories Images settings"
72
- msgstr "Kategoribildinställningar"
73
-
74
- #: ../../plugins/categories-images/categories-images.php:275
75
- msgid "Excluded Taxonomies"
76
- msgstr "Exkludera taxonomier"
77
-
78
- #: ../../plugins/categories-images/categories-images.php:280
79
- msgid ""
80
- "Please select the taxonomies you want to exclude it from Categories Images plugin"
81
- msgstr "Välj vilka taxonomier du vill exkludera från Kategoribildtillägget"
82
-
83
- #: ../../plugins/categories-images/categories-images.php:300
84
- msgid "You do not have sufficient permissions to access this page."
85
- msgstr "Du har inte tillräckliga rättigheter för att få tillgång till den här sidan."
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Categories Images\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: Fri Dec 04 2015 14:03:51 GMT+0100 (CET)\n"
6
+ "PO-Revision-Date: 2016-03-10 23:56+0200\n"
7
+ "Last-Translator: Munamamad El Zahlan <zahlan@theplanet.com.eg>\n"
8
+ "Language-Team: \n"
9
+ "Language: sv\n"
10
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-Basepath: .\n"
16
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;__:1;"
17
+ "_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;_x:1,2c;"
18
+ "_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;esc_attr__:1;"
19
+ "esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;esc_html_x:1,2c;"
20
+ "comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
21
+ "X-Loco-Target-Locale: sv_SE\n"
22
+ "X-Generator: Poedit 1.7.5\n"
23
+ "X-Poedit-SearchPath-0: ../../plugins/categories-images\n"
24
+
25
+ #. Name of the plugin
26
+ msgid "Categories Images"
27
+ msgstr "Kategoribilder"
28
+
29
+ #. URI of the plugin
30
+ msgid "http://zahlan.net/blog/2012/06/categories-images"
31
+ msgstr "http://zahlan.net/blog/2012/06/categories-images"
32
+
33
+ #. Description of the plugin
34
+ msgid ""
35
+ "Categories Images Plugin allow you to add an image to category or any custom term."
36
+ msgstr ""
37
+ "Kategoribildtillägget låter dig lägga till en bild till kategori eller annan egen "
38
+ "motsvarighet."
39
+
40
+ #. Author of the plugin
41
+ msgid "Muhammad Said El Zahlan"
42
+ msgstr "Muhammad Said El Zahlan"
43
+
44
+ #. Author URI of the plugin
45
+ msgid "http://zahlan.net"
46
+ msgstr "http://zahlan.net"
47
+
48
+ #: ../../plugins/categories-images/categories-images.php:61 ../..
49
+ #: plugins/categories-images/categories-images.php:82 ../../plugins/categories-
50
+ #: images/categories-images.php:229
51
+ msgid "Image"
52
+ msgstr "Bild"
53
+
54
+ #: ../../plugins/categories-images/categories-images.php:64 ../..
55
+ #: plugins/categories-images/categories-images.php:84 ../../plugins/categories-
56
+ #: images/categories-images.php:211
57
+ msgid "Upload/Add image"
58
+ msgstr "Ladda upp/Lägg till bild"
59
+
60
+ #: ../../plugins/categories-images/categories-images.php:85 ../..
61
+ #: plugins/categories-images/categories-images.php:212
62
+ msgid "Remove image"
63
+ msgstr "Ta bort bild"
64
+
65
+ #: ../../plugins/categories-images/categories-images.php:247
66
+ msgid "Thumbnail"
67
+ msgstr "Tumnagel"
68
+
69
+ #: ../../plugins/categories-images/categories-images.php:267 ../..
70
+ #: plugins/categories-images/categories-images.php:274
71
+ msgid "Categories Images settings"
72
+ msgstr "Kategoribildinställningar"
73
+
74
+ #: ../../plugins/categories-images/categories-images.php:275
75
+ msgid "Excluded Taxonomies"
76
+ msgstr "Exkludera taxonomier"
77
+
78
+ #: ../../plugins/categories-images/categories-images.php:280
79
+ msgid ""
80
+ "Please select the taxonomies you want to exclude it from Categories Images plugin"
81
+ msgstr "Välj vilka taxonomier du vill exkludera från Kategoribildtillägget"
82
+
83
+ #: ../../plugins/categories-images/categories-images.php:300
84
+ msgid "You do not have sufficient permissions to access this page."
85
+ msgstr "Du har inte tillräckliga rättigheter för att få tillgång till den här sidan."
readme.txt CHANGED
@@ -1,143 +1,146 @@
1
- === Categories Images ===
2
- Contributors: elzahlan
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G8LC4VSYKYSGA
4
- Tags: Category Image, Category Images, Categories Images, taxonomy image, taxonomy images, taxonomies images, category icon, categories icons, category logo, categories logos, admin, wp-admin, category image plugin, categories images plugin, category featured image, categories featured images, feature image for category
5
- Requires at least: 2.8
6
- Tested up to: 4.7
7
- Stable tag: 2.5.3
8
-
9
- The Categories Images Plugin allow you to add image with category or taxonomy.
10
-
11
- == Description ==
12
-
13
- The Categories Images Plugin allow you to add image with category or taxonomy.
14
-
15
- Use `<?php if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); ?>` to get the url and put it in any img tag or simply use `<?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>` in (category or taxonomy) template.
16
-
17
- Also from settings menu you can exclude any taxonomies from the plugin to avoid conflicting with another plugins like WooCommerce!
18
-
19
- = More documentation =
20
-
21
- Go to [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
22
-
23
- == Installation ==
24
-
25
- You can install Categories Images directly from the WordPress admin panel:
26
-
27
- 1. Visit the Plugins > Add New and search for 'Categories Images'.
28
- 2. Click to install.
29
- 3. Once installed, activate and it is functional.
30
-
31
- OR
32
-
33
- Manual Installation:
34
-
35
- 1. Download the plugin, then extract it.
36
- 2. Upload `categories-images` extracted folder to the `/wp-content/plugins/` directory
37
- 3. Activate the plugin through the 'Plugins' menu in WordPress
38
-
39
- You're done! The Plugin ready to use, for more please check the plugin description.
40
-
41
- = More documentation =
42
-
43
- Go to [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
44
-
45
- == Frequently Asked Questions ==
46
-
47
- Please check the documentation page:
48
- [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
49
-
50
- == Screenshots ==
51
-
52
- 1. Image preview and new image field in add/edit category or taxonomy with upload button which allow you to select current or upload a new image.
53
- 2. New image field with (upload/remove) buttons to allow you to edit category or taxonomy image in quick edit.
54
- 3. When you click the upload button the wordpress upload box will popup, upload or select image then press use this image.
55
- 4. New submenu (Categories Images) in Settings menu.
56
- 5. Now you can exclude any taxonomy from the plugin and save changes.
57
-
58
- == Changelog ==
59
- = 2.5.3 =
60
- * Fix not displaying single tag image bug in tag.php template
61
- * Adding language support for Swedish. Thanks to Simon Sandgren
62
-
63
- = 2.5.2 =
64
- * Fix displaying full size image bug in backend
65
- * Fix quick edit bug
66
- * Some code enhancements
67
-
68
- = 2.5.1 =
69
- * Adding language support for Russian.
70
- * Adding language support for Serbian. Thanks to Andrijana Nikolic [http://webhostinggeeks.com/].
71
- * Adding language support for Catalan. Thanks to Marc Queralt i Bassa [http://www.demomentsomtres.com/].
72
- * Change the plugin text domain from zci to categories-images to match the plugin slug as requested by Wordpress.
73
-
74
- = 2.5 =
75
- * Adding language support for Ukrainian. Thanks to Michael Yunat [http://getvoip.com].
76
- * Adding new function z_taxonomy_image() to display category or taxonomy image directly with support for size, alt and other attributes, for and how to use it please check the documentations.
77
- * Some code enhancements.
78
-
79
- = 2.4.2 =
80
- * Update code to reduce db queries. Thanks to fburatti [http://profiles.wordpress.org/fburatti/].
81
-
82
- = 2.4.1 =
83
- * Fix placeholder bug in backend.
84
-
85
- = 2.4 =
86
- * Adding language support for Spanish (Thansk so much to Maria Ramos [http://webhostinghub.com]).
87
- * Adding support for resizing categories images (Thanks so much to Rahil Wazir).
88
- * Some code enhancements.
89
-
90
- = 2.3.2 =
91
- * Adding language support for French.
92
-
93
- = 2.3.1 =
94
- * Bug fix in js for Wordpress media uploader.
95
-
96
- = 2.3 =
97
- * New screenshots.
98
- * Updated language file.
99
- * Added support for both old and new Wordpress media uploader.
100
- * Added new submenu (Categories Images) in Settings menu.
101
- * Added new settings for excluding any taxonomies from the plugin.
102
- * Added new placeholder image.
103
-
104
- Thanks to Patrick http://www.patrickbos.nl and Hassan http://profiles.wordpress.org/hassanhamm/ for the new ideas.
105
-
106
- = 2.2.4 =
107
- * java script bug fixed, reported about conflicting with WooCommerce plugin. Thanks to Marty McGee.
108
-
109
- = 2.2.3 =
110
- * bug fix in displaying category or taxonomy image at the frontend.
111
-
112
- = 2.2.2 =
113
- * bug fix in displaying placeholder image in wp-admin.
114
-
115
- = 2.2.1 =
116
- * edit z_taxonomy_image_url() to only return data in case the user inserted image for the selected category or taxonomy
117
-
118
- = 2.2 =
119
- * fix a bug, prevent a function from running execpt when editing a category or taxonomy to avoid affecting other wordpress edit pages in the wp-admin
120
-
121
- = 2.1 =
122
- * fix a bug in languages
123
- * fix a bug in quick edit category or taxonomy
124
-
125
- = 2.0 =
126
- * New screenshots.
127
- * Added l10n support.
128
- * Added Arabic and Chinese languages.
129
- * Added new button for upload or select an image using wordpress media uploader.
130
- * Added default image placeholder.
131
- * Added thumbnail in categories or taxonomies list.
132
- * Added image thumbnail, image text box, upload button and remove button in quick edit.
133
-
134
- Thank so much to Joe Tse http://tkjune.com :)
135
-
136
- = 1.2 =
137
- Adding some screenshots
138
-
139
- = 1.1 =
140
- Fix javascript bug with wordpress 3.4
141
-
142
- = 1.0 =
143
- The First Release
 
 
 
1
+ === Categories Images ===
2
+ Contributors: elzahlan
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G8LC4VSYKYSGA
4
+ Tags: Category Image, Category Images, Categories Images, taxonomy image, taxonomy images, taxonomies images, category icon, categories icons, category logo, categories logos, admin, wp-admin, category image plugin, categories images plugin, category featured image, categories featured images, feature image for category
5
+ Requires at least: 2.8
6
+ Tested up to: 4.9.1
7
+ Stable tag: 2.5.4
8
+
9
+ The Categories Images Plugin allow you to add image with category or taxonomy.
10
+
11
+ == Description ==
12
+
13
+ The Categories Images Plugin allow you to add image with category or taxonomy.
14
+
15
+ Use `<?php if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); ?>` to get the url and put it in any img tag or simply use `<?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>` in (category or taxonomy) template.
16
+
17
+ Also from settings menu you can exclude any taxonomies from the plugin to avoid conflicting with another plugins like WooCommerce!
18
+
19
+ = More documentation =
20
+
21
+ Go to [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
22
+
23
+ == Installation ==
24
+
25
+ You can install Categories Images directly from the WordPress admin panel:
26
+
27
+ 1. Visit the Plugins > Add New and search for 'Categories Images'.
28
+ 2. Click to install.
29
+ 3. Once installed, activate and it is functional.
30
+
31
+ OR
32
+
33
+ Manual Installation:
34
+
35
+ 1. Download the plugin, then extract it.
36
+ 2. Upload `categories-images` extracted folder to the `/wp-content/plugins/` directory
37
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
38
+
39
+ You're done! The Plugin ready to use, for more please check the plugin description.
40
+
41
+ = More documentation =
42
+
43
+ Go to [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
44
+
45
+ == Frequently Asked Questions ==
46
+
47
+ Please check the documentation page:
48
+ [http://zahlan.net/blog/2012/06/categories-images/](http://zahlan.net/blog/2012/06/categories-images/)
49
+
50
+ == Screenshots ==
51
+
52
+ 1. Image preview and new image field in add/edit category or taxonomy with upload button which allow you to select current or upload a new image.
53
+ 2. New image field with (upload/remove) buttons to allow you to edit category or taxonomy image in quick edit.
54
+ 3. When you click the upload button the wordpress upload box will popup, upload or select image then press use this image.
55
+ 4. New submenu (Categories Images) in Settings menu.
56
+ 5. Now you can exclude any taxonomy from the plugin and save changes.
57
+
58
+ == Changelog ==
59
+ = 2.5.4 =
60
+ * Fix compatibility with the latest Wordpress version
61
+
62
+ = 2.5.3 =
63
+ * Fix not displaying single tag image bug in tag.php template
64
+ * Adding language support for Swedish. Thanks to Simon Sandgren
65
+
66
+ = 2.5.2 =
67
+ * Fix displaying full size image bug in backend
68
+ * Fix quick edit bug
69
+ * Some code enhancements
70
+
71
+ = 2.5.1 =
72
+ * Adding language support for Russian.
73
+ * Adding language support for Serbian. Thanks to Andrijana Nikolic [http://webhostinggeeks.com/].
74
+ * Adding language support for Catalan. Thanks to Marc Queralt i Bassa [http://www.demomentsomtres.com/].
75
+ * Change the plugin text domain from zci to categories-images to match the plugin slug as requested by Wordpress.
76
+
77
+ = 2.5 =
78
+ * Adding language support for Ukrainian. Thanks to Michael Yunat [http://getvoip.com].
79
+ * Adding new function z_taxonomy_image() to display category or taxonomy image directly with support for size, alt and other attributes, for and how to use it please check the documentations.
80
+ * Some code enhancements.
81
+
82
+ = 2.4.2 =
83
+ * Update code to reduce db queries. Thanks to fburatti [http://profiles.wordpress.org/fburatti/].
84
+
85
+ = 2.4.1 =
86
+ * Fix placeholder bug in backend.
87
+
88
+ = 2.4 =
89
+ * Adding language support for Spanish (Thansk so much to Maria Ramos [http://webhostinghub.com]).
90
+ * Adding support for resizing categories images (Thanks so much to Rahil Wazir).
91
+ * Some code enhancements.
92
+
93
+ = 2.3.2 =
94
+ * Adding language support for French.
95
+
96
+ = 2.3.1 =
97
+ * Bug fix in js for Wordpress media uploader.
98
+
99
+ = 2.3 =
100
+ * New screenshots.
101
+ * Updated language file.
102
+ * Added support for both old and new Wordpress media uploader.
103
+ * Added new submenu (Categories Images) in Settings menu.
104
+ * Added new settings for excluding any taxonomies from the plugin.
105
+ * Added new placeholder image.
106
+
107
+ Thanks to Patrick http://www.patrickbos.nl and Hassan http://profiles.wordpress.org/hassanhamm/ for the new ideas.
108
+
109
+ = 2.2.4 =
110
+ * java script bug fixed, reported about conflicting with WooCommerce plugin. Thanks to Marty McGee.
111
+
112
+ = 2.2.3 =
113
+ * bug fix in displaying category or taxonomy image at the frontend.
114
+
115
+ = 2.2.2 =
116
+ * bug fix in displaying placeholder image in wp-admin.
117
+
118
+ = 2.2.1 =
119
+ * edit z_taxonomy_image_url() to only return data in case the user inserted image for the selected category or taxonomy
120
+
121
+ = 2.2 =
122
+ * fix a bug, prevent a function from running execpt when editing a category or taxonomy to avoid affecting other wordpress edit pages in the wp-admin
123
+
124
+ = 2.1 =
125
+ * fix a bug in languages
126
+ * fix a bug in quick edit category or taxonomy
127
+
128
+ = 2.0 =
129
+ * New screenshots.
130
+ * Added l10n support.
131
+ * Added Arabic and Chinese languages.
132
+ * Added new button for upload or select an image using wordpress media uploader.
133
+ * Added default image placeholder.
134
+ * Added thumbnail in categories or taxonomies list.
135
+ * Added image thumbnail, image text box, upload button and remove button in quick edit.
136
+
137
+ Thank so much to Joe Tse http://tkjune.com :)
138
+
139
+ = 1.2 =
140
+ Adding some screenshots
141
+
142
+ = 1.1 =
143
+ Fix javascript bug with wordpress 3.4
144
+
145
+ = 1.0 =
146
+ The First Release