Header Image Description

My brand new WordPress plugin Header Image Description grabs header images description hardcoded in functions.php (or in other places) and serve it for ALT, TITLE or other usage in template files.

Primary supports Twenty Ten and Twenty Eleven themes, but can be used in all themes that follow styling with header image.

Based on my self answered question on WP support forum Get header image description to string.

How to use?

First provide description in hardcoded image set in functions.php, something like this:

'footonsand' => array(
			'url' => '%s/images/headers/sand_and_foot.jpg',
			'thumbnail_url' => '%s/images/headers/sand_and_foot-thumbnail.jpg',
			'description' => __( 'Sand and Foot by Aleksandar Urošević', 'twentyten' )
		),

After installing and enabling HID from Plugins admin page, open your header.php template file, find line
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
and replace alt="" with alt="<?php header_image_desc(); ?>"

If you wish to display header image description in image tooltip, also add TITLE tag similar to ALT tag:
title="" with title="<?php header_image_desc(); ?>"

Download

Download from [Download nije pronadjen]

4 responses to Header Image Description

As I know, if header image is produced from post thumbnail, then WP already sets image description with text from Title set in Media tab. This plugin only provide description in variable to be used in already hardcoded header images.

But, if you give me some example, maybe we can do something more.

As I noticed in WP forum post (but not here, I’ll now add that), HID takes description from functions.php hardcoded descriptions and nothing to do with image description from media library. So, you need to set description like this:

'footonsand' => array(
'url' => '%s/images/headers/sand_and_foot.jpg',
'thumbnail_url' => '%s/images/headers/sand_and_foot-thumbnail.jpg',
'description' => __( 'Sand and Foot by Aleksandar Urošević', 'twentyten' )
),

For post image header descriptions WP already work w/o HID.

Leave a Reply