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 Header Image Description 0.1 (61)

4 Responses

  1. Michal
    Michal 22. oktobar 2011. at 17:19 · Reply

    Can it display image description set in Media tab without the need to hardcode these descriptions?

  2. Peter
    Peter 31. decembar 2011. at 05:44 · Reply

    I have a blog that has 5 header images, chosen at random. I want a different description for each one. I put the description in the description field in the media library, but the plugin can’t find those texts.

    http://maureenwhitingco.org/

Leave a Reply