[wp-trac] [WordPress Trac] #14720: get_bloginfo code, with get_template_* and get_stylesheet_*

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 28 10:56:39 UTC 2010


#14720: get_bloginfo code, with get_template_* and get_stylesheet_*
--------------------------+-------------------------------------------------
 Reporter:  Frumph        |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:                 
 Severity:  normal        |    Keywords:  close          
--------------------------+-------------------------------------------------

Comment(by nacin):

 The general rule of thumb as I've seen it, is that most theme designers
 who dabble in WordPress template tags enjoy the idea of a single function
 they can call and they will know exactly what it does. Many WP template
 tags don't take or don't require function arguments, and that's partly
 because template tags are designed to be simple and not feel like PHP
 functions.

 I don't like the idea of one-size-fits-all functions like bloginfo(). It's
 been around for a while, but if you look at its source, a lot of its
 arguments just call other functions. So ultimately it comes down to
 preference.

 You were confused about bloginfo('template_directory') versus
 get_template_directory_uri() versus get_template_directory(), but most
 theme developers wouldn't be, because A) they have little purpose for the
 path and probably have no concept of the alternative, B) it's dead simple
 to echo the results of these functions and determine what determines what,
 and C) if they *do* need the path, there's a function for it and they'll
 find it.

 The point is, 'template_directory' and 'template_directory_uri' are the
 same in bloginfo() and that simply won't change. Without even checking svn
 blame I am willing to bet that 'template_directory' came first, and that
 when we added the path functions, they added the URI argument so there was
 some consistency (or at least, not complete contradiction).

 The functions themselves are named fine, so I see no reason to rename
 those either. There's no need to mix and match the concepts because the
 functions serve all of the purposes, while bloginfo() also happens to
 exist as an alternative. I'd think in terms of one or the other --
 comparing them will be futile and we have far bigger (and less obvious)
 naming inconsistencies.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14720#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list