[wp-trac] [WordPress Trac] #38738: Remove front page restrictions from new custom header functions

WordPress Trac noreply at wordpress.org
Fri Nov 11 19:44:52 UTC 2016


#38738: Remove front page restrictions from new custom header functions
---------------------------+--------------------
 Reporter:  peterwilsoncc  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  4.7
Component:  Themes         |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+--------------------

Comment (by joemcgill):

 Replying to [comment:7 bradyvercher]:
 > I can't really think of any other functions that check a template
 conditional like this that could help influence the naming, but
 is_header_video_supported() sounds like it would be doing the same thing
 as current_theme_supports( 'custom-header', 'video' ).

 I don't think the use of a template conditional is as important as the
 fact that it allows a registered callback at all. For instance, if someone
 wanted to write their own theme callback that only allowed for video
 headers on the front-page or a set of custom landing pages, they could
 register a callback like `mytheme_show_video_headers_callback()`, which
 does something like:

 {{{#!php
 function mytheme_show_video_headers_callback() {
     if ( is_front_page() || is_page( 'page-slug' ) ) {
         return true;
     }

     return false;
 }
 }}}


 I agree with you. that the naming is a bit clunky, though. I wonder if
 there is a better place to include the logic from the proposed
 `is_header_video_active()` rather than including another function. Perhaps
 something we could check in `has_header_video()` depending on context?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38738#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list