[wp-trac] [WordPress Trac] #16268: Requirement for has_header_image() function?
WordPress Trac
wp-trac at lists.automattic.com
Mon Jan 17 16:10:21 UTC 2011
#16268: Requirement for has_header_image() function?
--------------------------+------------------------------
Reporter: husobj | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Template | Version:
Severity: normal | Resolution:
Keywords: header_image |
--------------------------+------------------------------
Comment (by garyc40):
For now you can use this:
{{{
if ( $header_image = get_header_image() ) {
// do something when there's a header image defined
}
}}}
In TwentyTen, at least in the current trunk version I'm using, there's a
check for header image so no broken image is output (line 76 - 79 in
header.php):
{{{
...
elseif ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" width="<?php echo
HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt=""
/>
<?php endif; ?>
...
}}}
Although I don't prefer this way of checking since it would call
{{{get_header_image()}}} twice, it works.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16268#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list