WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/image hwstring

Contents

Description

Retrieve width and height attributes using given width and height values.

Both attributes are required in the sense that both parameters must have a value, but are optional in that if you set them to false or null, then they will not be added to the returned string.

You can set the value using a string, but it will only take numeric values. If you wish to put 'px' after the numbers, then it will be stripped out of the return.

Usage

<?php image_hwstring$width$height ); ?>

Parameters

$width
(int|string) (required) Optional. Width attribute value.
Default: None
$height
(int|string) (required) Optional. Height attribute value.
Default: None

Return Values

(string) 
HTML attributes for width and, or height.

Change Log

Since: 2.5

Source File

image_hwstring() is located in wp-includes/media.php