BlogThemes

Adding Additional Default Headers to the WordPress Twenty Ten Theme

The Twenty Ten theme comes with eight default headers. Any default header that you just set is changed with the “featured picture” of a publish. You possibly can solely see the brand new header when viewing that publish. On this week’s WordPress Fast Tip we’ll see how easy it’s so as to add further headers to the Header’s Panel.

Watch the Screencast

Capabilities.php

Open up the features.php file of the Twenty Ten theme. Find the next part:

1
// Default customized headers packaged with the theme. %s is a placeholder for the theme template listing URI.

What follows is an array itemizing the present default headers and their location. So as to add your individual, add a comma after the final parenthesis of the array of sundown header. Right here’s an instance of what it will probably seem like after including two extra headers:

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
register_default_headers( array(
‘berries’ => array(
‘url’ => ‘%s/pictures/headers/berries.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/berries-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Berries’, ‘twentyten’ )
),
‘cherryblossom’ => array(
‘url’ => ‘%s/pictures/headers/cherryblossoms.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/cherryblossoms-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Cherry Blossoms’, ‘twentyten’ )
),
‘concave’ => array(
‘url’ => ‘%s/pictures/headers/concave.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/concave-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Concave’, ‘twentyten’ )
),
‘fern’ => array(
‘url’ => ‘%s/pictures/headers/fern.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/fern-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Fern’, ‘twentyten’ )
),
‘forestfloor’ => array(
‘url’ => ‘%s/pictures/headers/forestfloor.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/forestfloor-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Forest Flooring’, ‘twentyten’ )
),
‘inkwell’ => array(
‘url’ => ‘%s/pictures/headers/inkwell.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/inkwell-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Inkwell’, ‘twentyten’ )
),
‘path’ => array(
‘url’ => ‘%s/pictures/headers/path.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/path-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Path’, ‘twentyten’ )
),
‘sundown’ => array(
‘url’ => ‘%s/pictures/headers/sundown.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/sunset-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Sundown’, ‘twentyten’ )
),
‘waterfall’ => array(
‘url’ => ‘%s/pictures/headers/waterfall.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/waterfall-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Waterfall’, ‘twentyten’ )
),
‘mountain’ => array(
‘url’ => ‘%s/pictures/headers/mountain.jpg’,
‘thumbnail_url’ => ‘%s/pictures/headers/mountain-thumbnail.jpg’,
/* translators: header picture description */
‘description’ => __( ‘Mountain’, ‘twentyten’ )
)
) );

Lets dissect the code slightly bit.

register_default_headers : That is the operate that creates and shows our default headers. It accepts an array of parameters.

identify: Units a worth with our headers identify. We will then set an array of further values and keys.

url: Relative path to the header picture. Discover that the present path is /pictures/headers/image_name.jpg

thumbnail_url: Relative path to a thumbnail of the header picture. Present path is /pictures/headers/image_name-thumbnail.jpg

description: An outline of the picture. This is able to be show upon hovering over the picture contained in the Headers Panel.

Issues to Word

The Twenty Ten header is 940×198, something greater than that will be resized; something smaller can be stretch to suit these dimensions. The thumbnail pictures could be set to any dimensions, 230×48 is the default. The pictures can solely be .jpg or they are going to be ignored and received’t be displayed.

Download The WPSaviour App Now

Related posts
Beginner’s GuideBest WordPress PluginsBlog

9 Best Social Proof Plugins for WordPress & WooCommerce (2020)

Tips

How To Disable The WordPress User Admin Toolbar

Tips

WordPress Front Page vs Homepage

Tips

5 Things You Must Avoid Doing in WordPress

Leave a Reply

Your email address will not be published.

Pay in your preferred currency
Indian rupee
Euro