Unique Headers - Version 1.4.1

Version Description

Download this release

Release Info

Developer ryanhellyer
Plugin Icon wp plugin Unique Headers
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.3.13 to 1.4.1

README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ This is the development repository for the <a href="https://geek.hellyer.kiwi/plugins/unique-headers/">Unique Headers plugin</a> for WordPress.
2
+
3
+ For the latest and greatest version that actually works, please download the version from WordPress.org, since it is where the current stable version is hosted ... <a href="https://wordpress.org/plugins/unique-headers/">https://wordpress.org/plugins/unique-headers/</a>
inc/class-unique-headers-taxonomy-header-images.php CHANGED
@@ -169,7 +169,16 @@ class Unique_Header_Taxonomy_Header_Images {
169
  if ( is_numeric( $attachment_id ) ) {
170
  $new_url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
171
  } else {
172
- $new_url = $attachment_id;
 
 
 
 
 
 
 
 
 
173
  }
174
 
175
  // Only use new URL if it isn't blank ...
@@ -280,9 +289,18 @@ class Unique_Header_Taxonomy_Header_Images {
280
  if ( is_numeric( $attachment_id ) ) {
281
  $url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
282
  $title = Custom_Image_Meta_Box::get_attachment_title( $attachment_id );
283
- } elseif ( is_string( $attachment_id ) ) {
284
- $url = $attachment_id; // The attachment ID is actually the URL
285
- $title = ''; // We don't know the title since it's an attachment
 
 
 
 
 
 
 
 
 
286
  }
287
 
288
  ?>
169
  if ( is_numeric( $attachment_id ) ) {
170
  $new_url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
171
  } else {
172
+
173
+ // Falling back to taxonomy meta plugin functionality
174
+ $attachment_id = get_metadata( 'taxonomy', $tax_ID, 'taxonomy-header-image', true );
175
+
176
+ if ( is_numeric( $attachment_id ) ) {
177
+ $new_url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
178
+ } else {
179
+ $new_url = $attachment_id; // Defaulting back to really old version of the plugin which used URL's insteaded of attachment ID's
180
+ }
181
+
182
  }
183
 
184
  // Only use new URL if it isn't blank ...
289
  if ( is_numeric( $attachment_id ) ) {
290
  $url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
291
  $title = Custom_Image_Meta_Box::get_attachment_title( $attachment_id );
292
+ } else {
293
+
294
+ // Falling back to taxonomy meta plugin functionality
295
+ $attachment_id = get_metadata( 'taxonomy', $tag_ID, 'taxonomy-header-image', true );
296
+ if ( is_numeric( $attachment_id ) ) {
297
+ $url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
298
+ $title = Custom_Image_Meta_Box::get_attachment_title( $attachment_id );
299
+ } elseif ( is_string( $attachment_id ) ) {
300
+ $url = $attachment_id; // The attachment ID is actually the URL
301
+ $title = ''; // We don't know the title since it's an attachment
302
+ }
303
+
304
  }
305
 
306
  ?>
inc/legacy.php CHANGED
@@ -54,3 +54,16 @@ function unique_header_fallback_images( $post_id ) {
54
  return $attachment_id;
55
  }
56
  add_filter( 'unique_header_fallback_images', 'unique_header_fallback_images' );
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  return $attachment_id;
55
  }
56
  add_filter( 'unique_header_fallback_images', 'unique_header_fallback_images' );
57
+
58
+ /*
59
+ * Quick touchup to wpdb.
60
+ * This is a throwback to the taxonomy meta data plugin.
61
+ * Once that plugin has been upgraded and migrated users taxonomy data over, this function will not longer be required.
62
+ *
63
+ * @global object $wpdb The main WordPress database object
64
+ */
65
+ function unique_header_wpdbfix() {
66
+ global $wpdb;
67
+ $wpdb->taxonomymeta = "{$wpdb->prefix}taxonomymeta";
68
+ }
69
+ add_action( 'init', 'unique_header_wpdbfix' );
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Unique Headers
4
  Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/
5
  Description: Unique Headers
6
- Version: 1.3.13
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
3
  Plugin Name: Unique Headers
4
  Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/
5
  Description: Unique Headers
6
+ Version: 1.4.1
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: ryanhellyer
3
  Tags: custom-header, header, headers, images, page, post, plugin, image, images, categories, gallery, media, header-image, header-images, taxonomy, tag, category, posts, pages, taxonomies, post, page, unique, custom
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
- Requires at least: 4.3
6
  Tested up to: 4.5
7
- Stable tag: 1.3.13
8
 
9
 
10
 
@@ -15,10 +15,10 @@ Adds the ability to use unique custom header images on individual pages, posts o
15
  = Features =
16
  The <a href="https://geek.hellyer.kiwi/products/unique-headers/">Unique Headers Plugin</a> adds a custom header image box to the post/page edit screen. You can use this to upload a unique header image for that post, or use another image from your WordPress media library. When you view that page on the front-end of your site, the default header image for your site will be replaced by the unique header you selected.
17
 
18
- To use this functionality with categories or tags, you will also need to install the excellent <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>.
19
 
20
  = Requirements =
21
- You must use a theme which utilizes the built-in custom header functionality of WordPress. If your theme implement it's own header functionality, then this plugin will not work with it.
22
 
23
  = Language support =
24
  The plugin includes translations for the following languages:
@@ -35,20 +35,17 @@ After you've downloaded and extracted the files:
35
 
36
  1. Upload the complete 'unique-headers' folder to the '/wp-content/plugins/' directory OR install via the plugin installer
37
  2. Activate the plugin through the 'Plugins' menu in WordPress
38
- 3. If you need custom headers on taxonomy, category or tags pages, then also install and activate the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>.
39
  4. And yer done!
40
 
41
- Now you will see a new custom header image uploader whilst editing your site.
42
 
43
  Visit the <a href="https://geek.hellyer.kiwi/products/unique-headers/">Unique Headers Plugin</a> for more information.
44
 
45
 
46
  == Frequently Asked Questions ==
47
 
48
- = I can't change the image on my categories/tags, what's wrong? =
49
- You need to install the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>. WordPress does not support
50
- the taxonomy meta data which this plugin needs to use to store the custom header image URL. As soon as you install that plugin, the category/tag image
51
- functionality should begin working.
52
 
53
  = Your plugin doesn't work =
54
  Actually, it does work ;) The problem is likely with your theme. Some themes have "custom headers", but don't use the built-in WordPress custom header system and will not work with the Unique Headers plugin because of this. It is not possible to predict how other custom header systems work, and so those can not be supported by this plugin. To test if this is the problem, simply switch to one of the default themes which come with WordPress and see if the plugin works with those, if it does, then your theme is at fault.
@@ -56,8 +53,6 @@ Actually, it does work ;) The problem is likely with your theme. Some themes hav
56
  = My theme doesn't work with your plugin, how do I fix it? =
57
  This is a complex question and not something I can teach in a short FAQ. I recommend hiring a professional WordPress developer for assistance, or asking the developer of your theme to add support for the built-in WordPress custom header system.
58
 
59
- This is because WordPress does not provide a place for us to store data connected to a taxonomy such as a category or post tag. The Taxonomy Metadata plugin works around this problem by implement taxonomy meta. Future versions of WordPress are likely to include taxonomy meta baked in, and when this happens, the Unique Headers plugin will be updated to use that new functionality.
60
-
61
  = Does it work with custom post-types? =
62
  Not out of the box, but you can modify the following code to add support to suit your own requirements. You can can add this code to either your theme or to a custom plugin. You will need to modify the post-type to suit your own requirements. Some knowledge of PHP coding is necessary for this step.
63
 
@@ -113,7 +108,7 @@ I prefer to allow you to set the width and height yourself by opening a correct
113
 
114
  = Does it work in older versions of WordPress? =
115
 
116
- Probably, but I only actively support the latest version of WordPress. Support for older versions is purely by accident.
117
 
118
 
119
  = I need custom functionality. Can we pay you to build it for us? =
@@ -126,14 +121,16 @@ No, I'm too busy. Having said that, if you are willing to pay me a small fortune
126
 
127
  1. The new meta box as added to the posts/pages screen
128
  2. The custom header image uploader for adding new header images
129
- 3. The new meta box for categories and tags. This view is only seen when using the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>
130
 
131
 
132
  == Changelog ==
133
 
134
- Version 1.3.12: Added French language translation.
135
- Version 1.3.11: Moved instantiation and localization code into a class.
136
- Version 1.3.10: Added Deutsch (German) language translation.
 
 
137
  Version 1.3.9: Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).<br />
138
  Version 1.3.8: Modification translation system to work with changes on WordPress.org.<br />
139
  Version 1.3.7: Addition of Spanish translation<br />
@@ -156,5 +153,5 @@ Thanks to the following for help with the development of this plugin:<br />
156
  * <a href="http://www.graphicana.de/">Tobias Klotz</a> - Deutsch (German) language translation.
157
  * <a href="http://nakri.co.uk/">Nadia Tokerud</a> - Proof-reading of Norsk Bokmål (Norwegian) translation (coming soon)<br />
158
  * <a href="http://bjornjohansen.no/">Bjørn Johansen</a> - Proof-reading of Norwegian Bokmål translation (coming soon)<br />
159
- * <a href="https://www.facebook.com/kaljam/">Karl Olofsson</a> - Proof-reading of Swedish translation (coming soon)<br />
160
  * <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a> - French translation (coming soon)<br />
2
  Contributors: ryanhellyer
3
  Tags: custom-header, header, headers, images, page, post, plugin, image, images, categories, gallery, media, header-image, header-images, taxonomy, tag, category, posts, pages, taxonomies, post, page, unique, custom
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
+ Requires at least: 4.4
6
  Tested up to: 4.5
7
+ Stable tag: 1.4.1
8
 
9
 
10
 
15
  = Features =
16
  The <a href="https://geek.hellyer.kiwi/products/unique-headers/">Unique Headers Plugin</a> adds a custom header image box to the post/page edit screen. You can use this to upload a unique header image for that post, or use another image from your WordPress media library. When you view that page on the front-end of your site, the default header image for your site will be replaced by the unique header you selected.
17
 
18
+ This functionality also works with categories and tags.
19
 
20
  = Requirements =
21
+ You must use a theme which utilizes the built-in custom header functionality of WordPress. If your theme implement it's own header functionality, then this plugin will not work with it. Custom headers on tags and categories only works with WordPress 4.4 or newer.
22
 
23
  = Language support =
24
  The plugin includes translations for the following languages:
35
 
36
  1. Upload the complete 'unique-headers' folder to the '/wp-content/plugins/' directory OR install via the plugin installer
37
  2. Activate the plugin through the 'Plugins' menu in WordPress
 
38
  4. And yer done!
39
 
40
+ Now you will see a new custom header image uploader whilst editing posts, pages, tags or categories on your site.
41
 
42
  Visit the <a href="https://geek.hellyer.kiwi/products/unique-headers/">Unique Headers Plugin</a> for more information.
43
 
44
 
45
  == Frequently Asked Questions ==
46
 
47
+ = Do I need to install an extra plugin for categories/tags support? =
48
+ Only if you are using a version of WordPress older than 4.4. This functionality previously required the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>, but as of WordPress 4.4, that plugin is no longer required as terms meta was added to WordPress core. Your old categories and tags header images will be retained, but you should make sure that the taxonomy metadata plugin has upgraded your data before deactivating it.
 
 
49
 
50
  = Your plugin doesn't work =
51
  Actually, it does work ;) The problem is likely with your theme. Some themes have "custom headers", but don't use the built-in WordPress custom header system and will not work with the Unique Headers plugin because of this. It is not possible to predict how other custom header systems work, and so those can not be supported by this plugin. To test if this is the problem, simply switch to one of the default themes which come with WordPress and see if the plugin works with those, if it does, then your theme is at fault.
53
  = My theme doesn't work with your plugin, how do I fix it? =
54
  This is a complex question and not something I can teach in a short FAQ. I recommend hiring a professional WordPress developer for assistance, or asking the developer of your theme to add support for the built-in WordPress custom header system.
55
 
 
 
56
  = Does it work with custom post-types? =
57
  Not out of the box, but you can modify the following code to add support to suit your own requirements. You can can add this code to either your theme or to a custom plugin. You will need to modify the post-type to suit your own requirements. Some knowledge of PHP coding is necessary for this step.
58
 
108
 
109
  = Does it work in older versions of WordPress? =
110
 
111
+ Mostly, but I only actively support the latest version of WordPress. Support for older versions is purely by accident. Versions prior to 4.4 will definitely not work with categories and tags.
112
 
113
 
114
  = I need custom functionality. Can we pay you to build it for us? =
121
 
122
  1. The new meta box as added to the posts/pages screen
123
  2. The custom header image uploader for adding new header images
124
+ 3. The new meta box for categories and tags.
125
 
126
 
127
  == Changelog ==
128
 
129
+ Version 1.4.1: Documentation improvements.<br />
130
+ Version 1.4: Adding backwards compatibility to maintain header images provided by the Taxonomy metadata plugin.<br />
131
+ Version 1.3.12: Added French language translation.<br />
132
+ Version 1.3.11: Moved instantiation and localization code into a class.<br />
133
+ Version 1.3.10: Added Deutsch (German) language translation.<br />
134
  Version 1.3.9: Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).<br />
135
  Version 1.3.8: Modification translation system to work with changes on WordPress.org.<br />
136
  Version 1.3.7: Addition of Spanish translation<br />
153
  * <a href="http://www.graphicana.de/">Tobias Klotz</a> - Deutsch (German) language translation.
154
  * <a href="http://nakri.co.uk/">Nadia Tokerud</a> - Proof-reading of Norsk Bokmål (Norwegian) translation (coming soon)<br />
155
  * <a href="http://bjornjohansen.no/">Bjørn Johansen</a> - Proof-reading of Norwegian Bokmål translation (coming soon)<br />
156
+ * <a href="https://www.facebook.com/kaljam/">Karl Olofsson</a> - Proof-reading of Swedish translation<br />
157
  * <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a> - French translation (coming soon)<br />