Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




image_hwstring [ WordPress Function ]

image_hwstring ( $width, $height )
Parameters:
  • (int|string) $width Optional. Width attribute value.
  • (int|string) $height Optional. Height attribute value.
Returns:
  • (string) HTML attributes for width and, or height.
Defined at:



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.

Source


<?php
function image_hwstring($width$height) {
    
$out '';
    if (
$width)
        
$out .= 'width="'.intval($width).'" ';
    if (
$height)
        
$out .= 'height="'.intval($height).'" ';
    return 
$out;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics