Adding Additional Default Headers to the WordPress Twenty Ten Theme

Functions.php

Open up the functions.php file of the Twenty Ten theme. Locate the following section:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1

What follows is an array listing the current default headers and their location. To add your own, add a comma after the last parenthesis of the array of sunset header. Here’s an example of what it can look like after adding two more headers:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

Lets dissect the code a little bit.

register_default_headers : This is the function that creates and displays our default headers. It accepts an array of parameters.

name: Sets a value with our headers name. We can then set an array of additional values and keys.

url: Relative path to the header image. Notice that the current path is /images/headers/image_name.jpg

thumbnail_url: Relative path to a thumbnail of the header image. Current path is /images/headers/image_name-thumbnail.jpg

description: A description of the image. This would be display upon hovering over the image inside the Headers Panel.

Things to Note

The Twenty Ten header is 940×198, anything bigger than that would be resized; anything smaller would be stretch to fit those dimensions. The thumbnail images can be set to any dimensions, 230×48 is the default. The images can only be .jpg or they will be ignored and won’t be displayed.