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 (21)

4 komentar na zapis Header Image Description

  1. Michal kaže:

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

    • Aleksandar kaže:

      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.

  2. Peter kaže:

    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/

    • Aleksandar kaže:

      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.

Ostavite odgovor

Vaša adresa e-pošte neće biti objavljena. Neophodna polja su označena *

*

Možete koristiti ove HTML oznake i atribute: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>