Unique Headers - Version 1.5.1

Version Description

  • Overhauled outdated FAQ section of readme.
Download this release

Release Info

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

Code changes from version 1.4.8 to 1.5.1

Files changed (3) hide show
  1. inc/class-unique-headers-display.php +15 -9
  2. index.php +8 -4
  3. readme.txt +99 -71
inc/class-unique-headers-display.php CHANGED
@@ -52,21 +52,27 @@ class Unique_Headers_Display {
52
  */
53
  public function header_image_filter( $url ) {
54
 
55
- // Bail out now if not in post or page
56
- if ( ! is_single() && ! is_page() ) {
57
  return $url;
58
  }
59
 
60
- // Get custom URL
61
- $attachment_id = Custom_Image_Meta_Box::get_attachment_id( get_the_ID(), $this->name_underscores );
62
- $custom_url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
 
 
 
63
 
64
- // If custom URL doesn't exist, then output original URL
65
- if ( false == $custom_url ) {
66
- return $url;
 
 
 
67
  }
68
 
69
- return $custom_url;
70
  }
71
 
72
  }
52
  */
53
  public function header_image_filter( $url ) {
54
 
55
+ // Bail out now if not in post (is_single or is_page) or blog (is_home)
56
+ if ( ! is_single() && ! is_page() && ! is_home() ) {
57
  return $url;
58
  }
59
 
60
+ // Get current post ID (if on blog, then checks current posts page for it's ID)
61
+ if ( is_home() ) {
62
+ $post_id = get_option( 'page_for_posts' );
63
+ } else {
64
+ $post_id = get_the_ID();
65
+ }
66
 
67
+ // Get attachment ID
68
+ $attachment_id = Custom_Image_Meta_Box::get_attachment_id( $post_id, $this->name_underscores );
69
+
70
+ // Generate new URL
71
+ if ( is_numeric( $attachment_id ) ) {
72
+ $url = Custom_Image_Meta_Box::get_attachment_src( $attachment_id );
73
  }
74
 
75
+ return $url;
76
  }
77
 
78
  }
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.4.8
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
@@ -97,7 +97,7 @@ class Unique_Headers_Instantiate {
97
  'title' => __( 'Custom header', 'unique-headers' ),
98
  'set_custom_image' => __( 'Set Custom Header Image', 'unique-headers' ),
99
  'remove_custom_image' => __( 'Remove Custom Header Image', 'unique-headers' ),
100
- 'post_types' => apply_filters( 'unique_headers_post_types', array( 'post', 'page' ) ),
101
  );
102
 
103
  // Add support for post-types
@@ -107,9 +107,13 @@ class Unique_Headers_Instantiate {
107
  new Unique_Headers_Display( array( 'name' => $name ) );
108
  }
109
 
110
- // Add support for taxonomies
111
  if ( function_exists( 'get_term_meta' ) ) {
112
- $args['taxonomies'] = apply_filters( 'unique_headers_taxonomies', array( 'category', 'post_tag' ) );
 
 
 
 
113
  $args['upload_header_image'] = __( 'Upload header image', 'unique-headers' );
114
 
115
  new Unique_Header_Taxonomy_Header_Images( $args );
3
  Plugin Name: Unique Headers
4
  Plugin URI: https://geek.hellyer.kiwi/plugins/unique-headers/
5
  Description: Unique Headers
6
+ Version: 1.5.1
7
  Author: Ryan Hellyer
8
  Author URI: https://geek.hellyer.kiwi/
9
  Text Domain: unique-headers
97
  'title' => __( 'Custom header', 'unique-headers' ),
98
  'set_custom_image' => __( 'Set Custom Header Image', 'unique-headers' ),
99
  'remove_custom_image' => __( 'Remove Custom Header Image', 'unique-headers' ),
100
+ 'post_types' => get_post_types( array( 'public' => true ) ),
101
  );
102
 
103
  // Add support for post-types
107
  new Unique_Headers_Display( array( 'name' => $name ) );
108
  }
109
 
110
+ // Add support for taxonomies (this conditional can be removed after the release of WordPress 4.4 - plus the taxonmies argument above can be moved into the main array then)
111
  if ( function_exists( 'get_term_meta' ) ) {
112
+
113
+ // Add support for publicly available taxonomies - this can be moved into the main arguments array above after the release of WordPress 4.4
114
+ $args['taxonomies'] = get_taxonomies( array( 'public'=>true ) );
115
+
116
+ // Add upload text
117
  $args['upload_header_image'] = __( 'Upload header image', 'unique-headers' );
118
 
119
  new Unique_Header_Taxonomy_Header_Images( $args );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: custom-header, header, headers, images, page, post, plugin, image, images,
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
  Requires at least: 4.3
6
  Tested up to: 4.5
7
- Stable tag: 1.4.8
8
 
9
 
10
 
@@ -26,7 +26,7 @@ The plugin includes translations for the following languages:
26
  1. Spanish - provided by <a href="http://westoresolutions.com/">Mariano J. Ponce</a>
27
  2. German - provided by <a href="http://www.graphicana.de/">Tobias Klotz</a>
28
  3. French - provided by <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a>
29
- 4. Swedish - provided by <a href="https://twitter.com/CyanAlice">Alice Carlsson</a>
30
 
31
 
32
  == Installation ==
@@ -44,8 +44,13 @@ Visit the <a href="https://geek.hellyer.kiwi/products/unique-headers/">Unique He
44
 
45
  == Frequently Asked Questions ==
46
 
47
- = Do I need to install an extra plugin for categories/tags support? =
48
- No. 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.
@@ -54,47 +59,13 @@ Actually, it does work ;) The problem is likely with your theme. Some themes hav
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
 
59
- `
60
- <?php
61
 
62
- /*
63
- * Add support for a post-type called "some-post-type"
64
- *
65
- * @param array $post_types The currently supported post-types
66
- * @return array $post_types The modified list of supported post-types
67
- */
68
- function unique_headers_add_post_type( $post_types ) {
69
- $post_types[] = 'some-post-type';
70
-
71
- return $post_types;
72
- }
73
- add_filter( 'unique_headers_post_types', 'unique_headers_add_post_type' );
74
 
75
- ?>
76
- `
77
 
78
- = Does it work with taxonomies? =
79
- As with custom post-types, not out of the box. You can however 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 taxonomy to suit your own requirements. Some knowledge of PHP coding is necessary for this step.
80
-
81
- `
82
- <?php
83
-
84
- /*
85
- * Add support for a taxonomy called "some-taxonomy"
86
- *
87
- * @param array $taxonomies The currently supported taxonomies
88
- * @return array $taxonomies The modified list of supported taxonomies
89
- */
90
- function unique_headers_add_taxonomy( $taxonomies ) {
91
- $taxonomies[] = 'some-taxonomy';
92
- return $taxonomies;
93
- }
94
- add_filter( 'unique_headers_taxonomies', 'unique_headers_add_taxonomy' );
95
-
96
- ?>
97
- `
98
 
99
  = Where's the plugin settings page? =
100
 
@@ -126,39 +97,96 @@ No, I'm too busy. Having said that, if you are willing to pay me a small fortune
126
 
127
  == Changelog ==
128
 
129
- Version 1.4.8: Fixing a bug triggered by WordPress assigning non-URL's as the URL.
130
- Version 1.4.7: Setting a more sane plugin review time.
131
- Version 1.4.6: Fixing bug with handling taxonomies. Added plugin review notice back, but without the non-existent MONTH_IN_SECONDS constant.
132
- Version 1.4.5: Removing plugin review notice due to unsolvable errors.
133
- Version 1.4.4: Adding plugin review class back, with correct time stamp set.
134
- Version 1.4.3: Temporarily removing plugin review class until bugs are fixed.
135
- Version 1.4.2: Adding a plugin review class.
136
- Version 1.4.1: Instantiating the plugin later (allows for adding additional post-types in themes).
137
- Version 1.4: Adding backwards compatibility to maintain header images provided by the Taxonomy metadata plugin.
138
- Version 1.3.12: Added French language translation.
139
- Version 1.3.11: Moved instantiation and localization code into a class.
140
- Version 1.3.10: Added Deutsch (German) language translation.
141
- Version 1.3.9: Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).<br />
142
- Version 1.3.8: Modification translation system to work with changes on WordPress.org.<br />
143
- Version 1.3.7: Addition of Spanish translation<br />
144
- Version 1.3.1: Adjustment to match post meta key to other plugins, for compatibilty reasons.<br />
145
- Version 1.3: Total rewrite to use custom built in system for media uploads. Also adapted taxonomies to use ID's and added support for extra post-types and taxonomies.<br />
146
- Version 1.2: Converted to use the class from the Multiple Featured Images plugin<br />
147
- Version 1.1: Added support for tags <br />
148
- Version 1.0.4: Added support for displaying a category specific image on the single post pages<br />
149
- Version 1.0.3: Correction for $new_url for categories<br />
150
- Version 1.0.2: Bug fix to allow default header to display when no category specified<br />
151
- Version 1.0.1: Bug fixes for post/page thumbnails<br />
152
- Version 1.0: Initial release<br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
 
155
  = Credits =
156
 
157
  Thanks to the following for help with the development of this plugin:<br />
158
- * <a href="http://onmytodd.org">Todd</a> - Assistance with implementing support for tags<br />
159
- * <a href="http://westoresolutions.com/">Mariano J. Ponce</a> - Spanish translation<br />
160
  * <a href="http://www.graphicana.de/">Tobias Klotz</a> - Deutsch (German) language translation.
161
- * <a href="http://nakri.co.uk/">Nadia Tokerud</a> - Proof-reading of Norsk Bokmål (Norwegian) translation (coming soon)<br />
162
- * <a href="http://bjornjohansen.no/">Bjørn Johansen</a> - Proof-reading of Norwegian Bokmål translation (coming soon)<br />
163
- * <a href="https://www.facebook.com/kaljam/">Karl Olofsson</a> - Proof-reading of Swedish translation (coming soon)<br />
164
- * <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a> - French translation (coming soon)<br />
4
  Donate link: https://geek.hellyer.kiwi/donate/
5
  Requires at least: 4.3
6
  Tested up to: 4.5
7
+ Stable tag: 1.5.1
8
 
9
 
10
 
26
  1. Spanish - provided by <a href="http://westoresolutions.com/">Mariano J. Ponce</a>
27
  2. German - provided by <a href="http://www.graphicana.de/">Tobias Klotz</a>
28
  3. French - provided by <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a>
29
+ 4. Swedish - provided by <a href="https:r//twitter.com/CyanAlice">Alice Carlsson</a>
30
 
31
 
32
  == Installation ==
44
 
45
  == Frequently Asked Questions ==
46
 
47
+ = I upgraded to WordPress 4.4 and the taxonomy meta plugin broke. What should I do? =
48
+ Older versions of WordPress required the taxonomy meta data plugin to add support for categories and tags. However, that functionality was rolled into the core of WordPress 4.4 and the old plugin stopped working with no upgrade path. You can simply delete the plugin, and your site will behave as normal, but the old header images for categories and tags will be missing. To work around this problem, please <a href="https://wordpress.org/support/topic/wordpress-44-fatal-error?replies=9#post-7762404">follow the instructions in this helpful support thread</a> for that plugin. Please note that I am not connected with the taxonomy meta data plugin and can not provide any assistance with it.
49
+
50
+ = I set a category header image, but why are my individual posts not showing that header image? =
51
+ Setting a category (or other taxonomy) header image, only causes that header image to show on the category page itself. It does not make the header image show on the single posts of that category.
52
+
53
+ To add this functionality, please install the <a href="https://geek.hellyer.kiwi/plugins/unique-headers-single-posts/">Unique Headers single posts extension plugin</a>.
54
 
55
  = Your plugin doesn't work =
56
  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.
59
  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.
60
 
61
  = Does it work with custom post-types? =
 
62
 
63
+ Yes, as of version 1.5, support for publicly viewable custom post-types was added by default.
 
64
 
65
+ = Does it work with taxonomies? =
 
 
 
 
 
 
 
 
 
 
 
66
 
67
+ Yes, as of version 1.5 of the Unique Headers plugin and version 4.4 of WordPress, support for all publicly viewable custom taxonomies was added by default.
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  = Where's the plugin settings page? =
71
 
97
 
98
  == Changelog ==
99
 
100
+
101
+ = 1.5.1 =
102
+ * Overhauled outdated FAQ section of readme.
103
+
104
+ = 1.5 =
105
+ * Introduced unlimited taxonomy support.
106
+ * When using a blog page set to a static page URL, the image from the static pages custom header will be used.
107
+ * Adding support for all publicly viewable post-types.
108
+ * Adding support for all publicly viewable taxonomies.
109
+
110
+ = 1.4.8 =
111
+ * Fixing a bug triggered by WordPress assigning non-URL's as the URL.
112
+
113
+ = 1.4.7
114
+ * Setting a more sane plugin review time.
115
+
116
+ = 1.4.6 =
117
+ * Fixing bug with handling taxonomies. Added plugin review notice back, but without the non-existent MONTH_IN_SECONDS constant.
118
+
119
+ = 1.4.5 =
120
+ * Removing plugin review notice due to unsolvable errors.
121
+
122
+ = 1.4.4 =
123
+ * Adding plugin review class back, with correct time stamp set.
124
+
125
+ = 1.4.3 =
126
+ * Temporarily removing plugin review class until bugs are fixed.
127
+
128
+ = 1.4.2 =
129
+ * Adding a plugin review class.
130
+
131
+ = 1.4.1 =
132
+ * Instantiating the plugin later (allows for adding additional post-types in themes).
133
+
134
+ = 1.4 =
135
+ * Adding backwards compatibility to maintain header images provided by the Taxonomy metadata plugin.
136
+
137
+ = 1.3.12 =
138
+ * Added French language translation.
139
+
140
+ = 1.3.11 =
141
+ * Moved instantiation and localization code into a class.
142
+
143
+ = 1.3.10 =
144
+ * Added Deutsch (German) language translation.
145
+
146
+ = 1.3.9 =
147
+ * Fixing error which caused header images to disappear on upgrading (data was still available just not accessed correctly).
148
+
149
+ = 1.3.8 =
150
+ * Modification translation system to work with changes on WordPress.org.
151
+
152
+ = 1.3.7 =
153
+ * Addition of Spanish translation.
154
+
155
+ = 1.3.1 =
156
+ * Adjustment to match post meta key to other plugins, for compatibilty reasons.
157
+
158
+ = 1.3 =
159
+ * Total rewrite to use custom built in system for media uploads. Also adapted taxonomies to use ID's and added support for extra post-types and taxonomies.
160
+
161
+ = 1.2 =
162
+ * Converted to use the class from the Multiple Featured Images plugin.
163
+
164
+ = 1.1 =
165
+ * Added support for tags.
166
+
167
+ = 1.0.4 =
168
+ * Added support for displaying a category specific image on the single post pages.
169
+
170
+ = 1.0.3 =
171
+ * Correction for $new_url for categories.
172
+
173
+ = 1.0.2 =
174
+ * Bug fix to allow default header to display when no category specified.
175
+
176
+ = 1.0.1 =
177
+ * Bug fixes for post/page thumbnails.
178
+
179
+ = 1.0 =
180
+ * Initial release.
181
 
182
 
183
  = Credits =
184
 
185
  Thanks to the following for help with the development of this plugin:<br />
186
+ * <a href="http://onmytodd.org">Todd</a> - Assistance with implementing support for tags.
187
+ * <a href="http://westoresolutions.com/">Mariano J. Ponce</a> - Spanish translation.
188
  * <a href="http://www.graphicana.de/">Tobias Klotz</a> - Deutsch (German) language translation.
189
+ * <a href="http://nakri.co.uk/">Nadia Tokerud</a> - Proof-reading of Norsk Bokmål (Norwegian) translation.
190
+ * <a href="http://bjornjohansen.no/">Bjørn Johansen</a> - Proof-reading of Norwegian Bokmål translation.
191
+ * <a href="https://www.facebook.com/kaljam/">Karl Olofsson</a> - Proof-reading of Swedish translation.
192
+ * <a href="http://www.jennybeaumont.com/">Jenny Beaumont</a> - French translation.