[wp-trac] [WordPress Trac] #18548: Add a better option for <title> tags

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 5 17:51:33 UTC 2011


#18548: Add a better option for <title> tags
------------------------------------------------+--------------------------
 Reporter:  joostdevalk                         |       Owner:  joostdevalk
     Type:  enhancement                         |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
Component:  Template                            |  Review
 Severity:  normal                              |     Version:  3.3
 Keywords:  has-patch dev-feedback needs-codex  |  Resolution:
------------------------------------------------+--------------------------
Changes (by F J Kaiser):

 * cc: 24-7@… (added)


Comment:

 I really don't understand why this "patch" is needed. I can't imagine a
 ''real'' reason for not using the filter that already comes with
 {{{wp_title();}}}. Pushing stuff like this into core is like gasoline for
 the discussions about "WordPress is bloat ware". Imho the structure inside
 the function is good, but {{{general-template.php}}} is the wrong place.
 This should be part of Twenty Eleven to teach people how to do it right. I
 think this will bring up much more confusion than help.

 Anyway, if this really makes it's way into core, here are the things I
 want to mention to improve the internal structure of
 {{{_wp_render_title_tag();}}}:
 * Use an associative array for {{{$title}}} as it's easier to understand
 how to overwrite parts for non-tech savy users (a.k.a. the majority).
 * Using the wrong hooks is imo not a ''real'' Error. Switch to
 {{{_doing_it_wrong();}}}. Using the wrong hook happens to the best devs
 all the time and using that function is much more polite (From the doc
 block of {{{_doing_it_wrong();}}}: Marks something as beeing incorrectly
 called).
 * ''I'm not a big fan of different coding styles - if you want to call it
 like this - inside a single function''. From {{{title-tag-3.diff}}}:
 {{{$title = implode( " $sep ", $title );}}} vs. {{{echo '<title>' . $pre .
 "<title>\n";}}} doesn't help much to make core more readable and easier to
 understand.
 * The same goes for {{{if ( null !== $pre = apply_filters(
 'pre_wp_title_tag', null ) ) {}}}. Having the filter attached to
 {{{$pre}}} one line earlier makes it much easier to read.
 * I'd rename the {{{pre_wp_title_tag}}} filter to
 {{{wp_title_tag_walker}}}. Imo it's nothing else.
 * About input {{{$args}}} and {{{$defaults}}}: We got the wonderful
 function named {{{wp_parse_args();}}} in core - which is imo used not
 often enough. Why not use this and make an easy to read/understand array
 of default values at the beginning and then parse it with the data
 received via {{{add_theme_support();}}}?

 Just my 2 cents (I still think this function shouldn't be added just
 because plugins/themes are missusing the {{{wp_title();}}} filter.

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


More information about the wp-trac mailing list