Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bring custom header code in line with current best practice.

This commit brings two changes: replacing the use of the deprecated
add_custom_image_header function, and no longer defining header
image constants, as these are now defined by the add_theme_support
function when called with the 'custom-header' argument.
  • Loading branch information...
commit 8d5bc781c1e2c1661fccfd351c03757362410a45 1 parent f9ae2ce
@beastaugh authored
Showing with 18 additions and 13 deletions.
  1. +2 −0  changelog.txt
  2. +16 −13 functions.php
View
2  changelog.txt
@@ -4,6 +4,8 @@
* Moved language files to `/languages` directory.
* Added POT file to theme files in `languages` directory.
+ * Replaced use of deprecated `add_custom_image_header` function.
+ * Stop defining header image constants.
* Deprecated `tarski_doctitle` in favour of a filter on `wp_title`.
* Updated the author details per Theme Directory requirements.
* Updated theme description to explain more of its advantages.
View
29 functions.php
@@ -78,19 +78,22 @@
// Localisation
load_theme_textdomain('tarski', get_template_directory() . '/languages');
-// Custom header image
-if (!defined('HEADER_TEXTCOLOR'))
- define('HEADER_TEXTCOLOR', '');
-if (!defined('HEADER_IMAGE')) // %s is theme directory URI
- define('HEADER_IMAGE', '%s/headers/' . get_tarski_option('header'));
-if (!defined('HEADER_IMAGE_WIDTH'))
- define('HEADER_IMAGE_WIDTH', 720);
-if (!defined('HEADER_IMAGE_HEIGHT'))
- define('HEADER_IMAGE_HEIGHT', 180);
-if (!defined('NO_HEADER_TEXT'))
- define('NO_HEADER_TEXT', true);
-
-add_custom_image_header('', 'tarski_admin_header_style');
+// Custom header support
+add_theme_support('custom-header', array(
+ 'default-image' => '%s/headers/' . get_tarski_option('header'),
+ 'random-default' => false,
+ 'width' => 720,
+ 'height' => 180,
+ 'flex-height' => false,
+ 'flex-width' => false,
+ 'default-text-color' => '',
+ 'header-text' => false,
+ 'uploads' => true,
+ 'wp-head-callback' => '',
+ 'admin-head-callback' => 'tarski_admin_header_style',
+ 'admin-preview-callback' => ''
+));
+
register_default_headers(_tarski_list_header_images());
// Content width; set this in a plugin or child theme if you want to change
Please sign in to comment.
Something went wrong with that request. Please try again.