Unique Headers - Version 1.0.1

Version Description

Download this release

Release Info

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

Code changes from version 1.0 to 1.0.1

inc/class-category-header-images.php CHANGED
@@ -114,7 +114,7 @@ class Category_Header_Images {
114
  * @author Ryan Hellyer <ryan@pixopoint.com>
115
  * @since 1.0
116
  */
117
- function header_image_filter( $url ) {
118
 
119
  // Bail out now if not in category
120
  if ( ! is_category() )
114
  * @author Ryan Hellyer <ryan@pixopoint.com>
115
  * @since 1.0
116
  */
117
+ public function header_image_filter( $url ) {
118
 
119
  // Bail out now if not in category
120
  if ( ! is_category() )
inc/class-multi-post-thumbnails.php CHANGED
@@ -75,7 +75,7 @@ class MultiPostThumbnails {
75
 
76
  add_action('add_meta_boxes', array($this, 'add_metabox'));
77
  add_filter('attachment_fields_to_edit', array($this, 'add_attachment_field'), 20, 2);
78
- add_action('admin_init', array($this, 'enqueue_admin_scripts'));
79
  add_action("wp_ajax_set-{$this->post_type}-{$this->id}-thumbnail", array($this, 'set_thumbnail'));
80
  add_action('delete_attachment', array($this, 'action_delete_attachment'));
81
  }
@@ -130,14 +130,14 @@ class MultiPostThumbnails {
130
  }
131
 
132
  /**
133
- * Enqueue admin JavaScripts
134
  *
135
- * @return void
136
  */
137
  public function enqueue_admin_scripts() {
138
 
139
  // Bail out now if not on edit post/page page
140
- if ( empty( $_GET['post'] ) )
141
  return;
142
 
143
  // Enqueue the script
@@ -157,7 +157,7 @@ class MultiPostThumbnails {
157
  * @global object $wpdb
158
  * @param int $post_id
159
  */
160
- public function action_delete_attachment($post_id) {
161
  global $wpdb;
162
  $meta_key = "{$this->post_type}_{$this->id}_thumbnail_id";
163
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '%s' AND meta_value = %d", $meta_key, $post_id ));
75
 
76
  add_action('add_meta_boxes', array($this, 'add_metabox'));
77
  add_filter('attachment_fields_to_edit', array($this, 'add_attachment_field'), 20, 2);
78
+ add_action( 'admin_init', array( $this, 'enqueue_admin_scripts' ) );
79
  add_action("wp_ajax_set-{$this->post_type}-{$this->id}-thumbnail", array($this, 'set_thumbnail'));
80
  add_action('delete_attachment', array($this, 'action_delete_attachment'));
81
  }
130
  }
131
 
132
  /**
133
+ * Enqueue admin scripts
134
  *
135
+ * @author Ryan Hellyer <ryan@metronet.no>
136
  */
137
  public function enqueue_admin_scripts() {
138
 
139
  // Bail out now if not on edit post/page page
140
+ if ( !isset( $_GET['post'] ) && !isset( $_GET['post_id'] ) )
141
  return;
142
 
143
  // Enqueue the script
157
  * @global object $wpdb
158
  * @param int $post_id
159
  */
160
+ public function action_delete_attachment( $post_id ) {
161
  global $wpdb;
162
  $meta_key = "{$this->post_type}_{$this->id}_thumbnail_id";
163
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '%s' AND meta_value = %d", $meta_key, $post_id ));
inc/class-post-header-images.php CHANGED
@@ -45,8 +45,14 @@ class Post_Header_Images {
45
  // Grab current post ID
46
  $post_ID = $post->ID;
47
 
 
 
 
 
 
 
48
  // Grab the post thumbnail ID
49
- $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id( 'post', 'custom-header', $post_ID );
50
 
51
  // If no post thumbnail ID set, then use default
52
  if ( '' == $post_thumbnail_id )
45
  // Grab current post ID
46
  $post_ID = $post->ID;
47
 
48
+ // Pick post type
49
+ if ( is_single() )
50
+ $slug = 'post';
51
+ else
52
+ $slug = 'page';
53
+
54
  // Grab the post thumbnail ID
55
+ $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id( $slug, 'custom-header', $post_ID );
56
 
57
  // If no post thumbnail ID set, then use default
58
  if ( '' == $post_thumbnail_id )
index.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: Unique Headers
4
  Plugin URI: http://pixopoint.com/
5
  Description: Unique Headers
6
- Version: 1.0
7
- Author: Ryan Hellyer / Metronet
8
  Author URI: http://pixopoint.com/
9
 
10
  ------------------------------------------------------------------------
@@ -23,9 +23,11 @@ GNU General Public License for more details.
23
  You should have received a copy of the GNU General Public License
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
26
  */
27
 
28
 
 
29
  /**
30
  * Do not continue processing since file was called directly
31
  *
3
  Plugin Name: Unique Headers
4
  Plugin URI: http://pixopoint.com/
5
  Description: Unique Headers
6
+ Version: 1.0.1
7
+ Author: Ryan Hellyer
8
  Author URI: http://pixopoint.com/
9
 
10
  ------------------------------------------------------------------------
23
  You should have received a copy of the GNU General Public License
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
+
27
  */
28
 
29
 
30
+
31
  /**
32
  * Do not continue processing since file was called directly
33
  *
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Unique Headers ===
2
  Contributors: ryanhellyer, metronet
3
- Tags: header, metronet, pixopoint, headers, image, header-image, header-images, taxonomy, posts, pages, taxonomies, post, page, unique
4
  Donate link: http://pixopoint.com/donate/
5
  Requires at least: 3.4
6
- Stable tag: 1.0
7
 
8
 
9
  Adds the ability to use unique custom headers on individual pages, posts or categories.
@@ -62,6 +62,7 @@ No, I'm too busy. Having said that, if you want to pay me a small fortune then I
62
 
63
  == Changelog ==
64
 
 
65
  Version 1.0: Initial release<br />
66
 
67
 
1
  === Unique Headers ===
2
  Contributors: ryanhellyer, metronet
3
+ Tags: header, pixopoint, headers, image, header-image, header-images, taxonomy, posts, pages, taxonomies, post, page, unique
4
  Donate link: http://pixopoint.com/donate/
5
  Requires at least: 3.4
6
+ Stable tag: 1.0.1
7
 
8
 
9
  Adds the ability to use unique custom headers on individual pages, posts or categories.
62
 
63
  == Changelog ==
64
 
65
+ Version 1.0.1: Bug fixes for post/page thumbnails<br />
66
  Version 1.0: Initial release<br />
67
 
68