[wp-trac] [WordPress Trac] #16268: Requirement for has_header_image() function?

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 17 12:05:25 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        |   Keywords:  header_image
--------------------------+-----------------------------
 I know is pretty easy to do, but would it be a good idea to provide a
 has_header_image() function for use in themes? Something along the lines
 of:

 {{{
 function has_header_image() {
    $header_image = get_header_image();
    return !empty( $header_image );
 }
 }}}

 As the header_image() function just outputs the URL it would be handy to
 have a conditional function you could use to check when there was a header
 image to output.

 I'm currently working on a plugin that gives you more granular control
 over using different header images on different pages using the
 'theme_mod_header_image' filter. There may be instances when you do not
 want to show a header at all on some pages. In the current TwentyTen theme
 for example, no checking is done before the header_image() function is
 called so in this scenario the header image just appears as a broken image
 - ideally it should not output the image at all.

 Either that or should there be a function which outputs the whole image
 tag so that if the header_image() function returns false/empty it does not
 output the tag at all?

 What are people's thoughts on this?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16268>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list