Version Description
Download this release
Release Info
| Developer | ryanhellyer |
| Plugin | |
| Version | 1.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 1.1
- inc/{class-category-header-images.php → class-taxonomy-header-images.php} +15 -15
- index.php +3 -3
- readme.txt +10 -8
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
inc/{class-category-header-images.php → class-taxonomy-header-images.php}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
-
* Add
|
| 5 |
*
|
| 6 |
* @copyright Copyright (c), Ryan Hellyer
|
| 7 |
* @license http://www.gnu.org/licenses/gpl.html GPL
|
| 8 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 9 |
* @since 1.0
|
| 10 |
*/
|
| 11 |
-
class
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Class constructor
|
|
@@ -39,10 +39,13 @@ class Category_Header_Images {
|
|
| 39 |
add_action( 'admin_print_scripts', array( $this, 'print_styles' ) );
|
| 40 |
add_action( 'admin_print_scripts', array( $this, 'external_scripts' ) );
|
| 41 |
add_action( 'admin_head', array( $this, 'inline_scripts' ) );
|
| 42 |
-
|
| 43 |
-
add_action(
|
|
|
|
|
|
|
| 44 |
add_action( 'edit_category', array( $this, 'storing_taxonomy_data' ) );
|
| 45 |
-
|
|
|
|
| 46 |
|
| 47 |
// Add filter for category image (uses reduced priority to ensure that single post thumbnails override it)
|
| 48 |
add_filter( 'theme_mod_header_image', array( $this, 'header_image_filter' ), 5 );
|
|
@@ -116,17 +119,14 @@ class Category_Header_Images {
|
|
| 116 |
* @since 1.0
|
| 117 |
*/
|
| 118 |
public function header_image_filter( $url ) {
|
| 119 |
-
global $post;
|
| 120 |
|
| 121 |
-
// Grab current
|
| 122 |
-
if ( is_category() )
|
| 123 |
$tag_ID = get_query_var( 'cat' );
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
$
|
| 128 |
-
$category = $category[0];
|
| 129 |
-
$tag_ID = $category->cat_ID;
|
| 130 |
}
|
| 131 |
|
| 132 |
// Bail out now if no category set
|
|
@@ -136,7 +136,7 @@ class Category_Header_Images {
|
|
| 136 |
// Grab stored taxonomy header
|
| 137 |
$new_url = get_term_meta( $tag_ID, 'taxonomy-header-image', true );
|
| 138 |
|
| 139 |
-
//
|
| 140 |
if ( '' != $new_url )
|
| 141 |
$url = $new_url;
|
| 142 |
|
| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
+
* Add taxonomy specific header images
|
| 5 |
*
|
| 6 |
* @copyright Copyright (c), Ryan Hellyer
|
| 7 |
* @license http://www.gnu.org/licenses/gpl.html GPL
|
| 8 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 9 |
* @since 1.0
|
| 10 |
*/
|
| 11 |
+
class Taxonomy_Header_Images {
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Class constructor
|
| 39 |
add_action( 'admin_print_scripts', array( $this, 'print_styles' ) );
|
| 40 |
add_action( 'admin_print_scripts', array( $this, 'external_scripts' ) );
|
| 41 |
add_action( 'admin_head', array( $this, 'inline_scripts' ) );
|
| 42 |
+
|
| 43 |
+
add_action( 'category_edit_form_fields', array( $this, 'extra_fields'), 1 );
|
| 44 |
+
add_action( 'post_tag_edit_form_fields', array( $this, 'extra_fields'), 1 );
|
| 45 |
+
|
| 46 |
add_action( 'edit_category', array( $this, 'storing_taxonomy_data' ) );
|
| 47 |
+
add_action( 'edit_post_tag', array( $this, 'storing_taxonomy_data' ) );
|
| 48 |
+
}
|
| 49 |
|
| 50 |
// Add filter for category image (uses reduced priority to ensure that single post thumbnails override it)
|
| 51 |
add_filter( 'theme_mod_header_image', array( $this, 'header_image_filter' ), 5 );
|
| 119 |
* @since 1.0
|
| 120 |
*/
|
| 121 |
public function header_image_filter( $url ) {
|
|
|
|
| 122 |
|
| 123 |
+
// Grab current taxonomy ID
|
| 124 |
+
if ( is_category() ) {
|
| 125 |
$tag_ID = get_query_var( 'cat' );
|
| 126 |
+
} else if ( is_tag() ) {
|
| 127 |
+
$tag_info = get_query_var( 'tag' );
|
| 128 |
+
$tag = get_term_by( 'slug', $tag_info, 'post_tag' );
|
| 129 |
+
$tag_ID = $tag->term_id;
|
|
|
|
|
|
|
| 130 |
}
|
| 131 |
|
| 132 |
// Bail out now if no category set
|
| 136 |
// Grab stored taxonomy header
|
| 137 |
$new_url = get_term_meta( $tag_ID, 'taxonomy-header-image', true );
|
| 138 |
|
| 139 |
+
// Only use new URL if it isn't blank ...
|
| 140 |
if ( '' != $new_url )
|
| 141 |
$url = $new_url;
|
| 142 |
|
index.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: Unique Headers
|
| 4 |
Plugin URI: http://geek.ryanhellyer.net/
|
| 5 |
Description: Unique Headers
|
| 6 |
-
Version: 1.
|
| 7 |
Author: Ryan Hellyer / Metronet
|
| 8 |
Author URI: http://geek.ryanhellyer.net/
|
| 9 |
|
|
@@ -43,7 +43,7 @@ if ( !defined( 'ABSPATH' ) )
|
|
| 43 |
* @since 1.0
|
| 44 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 45 |
*/
|
| 46 |
-
require( 'inc/class-
|
| 47 |
require( 'inc/class-post-header-images.php' );
|
| 48 |
require( 'inc/class-multi-post-thumbnails.php' );
|
| 49 |
|
|
@@ -63,7 +63,7 @@ define( 'UNIQUEHEADERS_OPTION', 'hyper-headers' );
|
|
| 63 |
* @since 1.0
|
| 64 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 65 |
*/
|
| 66 |
-
new
|
| 67 |
new Post_Header_Images();
|
| 68 |
new MultiPostThumbnails(
|
| 69 |
array(
|
| 3 |
Plugin Name: Unique Headers
|
| 4 |
Plugin URI: http://geek.ryanhellyer.net/
|
| 5 |
Description: Unique Headers
|
| 6 |
+
Version: 1.1
|
| 7 |
Author: Ryan Hellyer / Metronet
|
| 8 |
Author URI: http://geek.ryanhellyer.net/
|
| 9 |
|
| 43 |
* @since 1.0
|
| 44 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 45 |
*/
|
| 46 |
+
require( 'inc/class-taxonomy-header-images.php' );
|
| 47 |
require( 'inc/class-post-header-images.php' );
|
| 48 |
require( 'inc/class-multi-post-thumbnails.php' );
|
| 49 |
|
| 63 |
* @since 1.0
|
| 64 |
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
| 65 |
*/
|
| 66 |
+
new Taxonomy_Header_Images();
|
| 67 |
new Post_Header_Images();
|
| 68 |
new MultiPostThumbnails(
|
| 69 |
array(
|
readme.txt
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
=== Unique Headers ===
|
| 2 |
Contributors: ryanhellyer, metronet
|
| 3 |
-
Tags: header, metronet,
|
| 4 |
Donate link: http://geek.ryanhellyer.net/donate/
|
| 5 |
Requires at least: 3.4
|
| 6 |
-
Stable tag: 1.
|
| 7 |
|
| 8 |
|
| 9 |
-
Adds the ability to use unique custom headers on individual pages, posts or categories.
|
| 10 |
|
| 11 |
== Description ==
|
| 12 |
|
| 13 |
The <a href="http://geek.ryanhellyer.net/products/unique-headers/">Unique Headers Plugin</a> adds the ability to use unique custom headers on
|
| 14 |
-
individual pages, posts or categories. This plugin makes use of the excellent <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a> for handling header images for categories.
|
| 15 |
|
| 16 |
-
The creation of this plugin was sponsored by the <a href="http://www.dss.dep.no/">Norwegian Government Administration Services (G.A.S.)</a> and <a href="http://metronet.no/">Metronet</a>.
|
| 17 |
|
| 18 |
|
| 19 |
== Installation ==
|
|
@@ -32,11 +32,11 @@ Visit the <a href="http://pixopoint.com/products/unique-headers/">Unique Headers
|
|
| 32 |
|
| 33 |
== Frequently Asked Questions ==
|
| 34 |
|
| 35 |
-
= I can't change the image on my categories, what's wrong? =
|
| 36 |
|
| 37 |
You need to install the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>. WordPress does not support
|
| 38 |
-
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 image
|
| 39 |
-
functionality should
|
| 40 |
|
| 41 |
|
| 42 |
= Where's the settings page? =
|
|
@@ -62,6 +62,7 @@ No, I'm too busy. Having said that, if you are willing to pay me a small fortune
|
|
| 62 |
|
| 63 |
== Changelog ==
|
| 64 |
|
|
|
|
| 65 |
Version 1.0.4: Added support for displaying a category specific image on the single post pages<br />
|
| 66 |
Version 1.0.3: Correction for $new_url for categories<br />
|
| 67 |
Version 1.0.2: Bug fix to allow default header to display when no category specified<br />
|
|
@@ -72,5 +73,6 @@ Version 1.0: Initial release<br />
|
|
| 72 |
= Credits =
|
| 73 |
|
| 74 |
Thanks to the following for help with the development of this plugin:<br />
|
|
|
|
| 75 |
* <a href="http://metronet.no/">Metronet</a> - Plugin sponsor<br />
|
| 76 |
* <a href="http://www.dss.dep.no/">Norwegian Government Administration Services (G.A.S.)</a> - Plugin sponsor<br />
|
| 1 |
=== Unique Headers ===
|
| 2 |
Contributors: ryanhellyer, metronet
|
| 3 |
+
Tags: header, metronet, headers, image, header-image, header-images, taxonomy, tag, category, posts, pages, taxonomies, post, page, unique
|
| 4 |
Donate link: http://geek.ryanhellyer.net/donate/
|
| 5 |
Requires at least: 3.4
|
| 6 |
+
Stable tag: 1.1
|
| 7 |
|
| 8 |
|
| 9 |
+
Adds the ability to use unique custom headers on individual pages, posts or categories or tags.
|
| 10 |
|
| 11 |
== Description ==
|
| 12 |
|
| 13 |
The <a href="http://geek.ryanhellyer.net/products/unique-headers/">Unique Headers Plugin</a> adds the ability to use unique custom headers on
|
| 14 |
+
individual pages, posts or categories. This plugin makes use of the excellent <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a> for handling header images for categories and tags.
|
| 15 |
|
| 16 |
+
The creation of this plugin was sponsored by the <a href="http://www.dss.dep.no/">Norwegian Government Administration Services (G.A.S.)</a> and <a href="http://metronet.no/">Metronet</a>. Coding assistance was provided from <a href="http://camaya.net/">Jakob Schröter</a>.
|
| 17 |
|
| 18 |
|
| 19 |
== Installation ==
|
| 32 |
|
| 33 |
== Frequently Asked Questions ==
|
| 34 |
|
| 35 |
+
= I can't change the image on my categories/tags, what's wrong? =
|
| 36 |
|
| 37 |
You need to install the <a href="http://wordpress.org/extend/plugins/taxonomy-metadata/">Taxonomy Metadata plugin</a>. WordPress does not support
|
| 38 |
+
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
|
| 39 |
+
functionality should begin working.
|
| 40 |
|
| 41 |
|
| 42 |
= Where's the settings page? =
|
| 62 |
|
| 63 |
== Changelog ==
|
| 64 |
|
| 65 |
+
Version 1.1: Added support for tags <br />
|
| 66 |
Version 1.0.4: Added support for displaying a category specific image on the single post pages<br />
|
| 67 |
Version 1.0.3: Correction for $new_url for categories<br />
|
| 68 |
Version 1.0.2: Bug fix to allow default header to display when no category specified<br />
|
| 73 |
= Credits =
|
| 74 |
|
| 75 |
Thanks to the following for help with the development of this plugin:<br />
|
| 76 |
+
* <a href="http://onmytodd.org">Todd</a> - Assistance with implementing support for tags<br />
|
| 77 |
* <a href="http://metronet.no/">Metronet</a> - Plugin sponsor<br />
|
| 78 |
* <a href="http://www.dss.dep.no/">Norwegian Government Administration Services (G.A.S.)</a> - Plugin sponsor<br />
|
screenshot-1.png
CHANGED
|
Binary file
|
screenshot-2.png
CHANGED
|
Binary file
|
