[wp-trac] [WordPress Trac] #10643: Refactor <title> tag content generation
WordPress Trac
wp-trac at lists.automattic.com
Tue Aug 18 16:33:56 UTC 2009
#10643: Refactor <title> tag content generation
-------------------------+--------------------------------------------------
Reporter: sirzooro | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.9
Component: Template | Version: 2.8
Severity: normal | Keywords: needs-patch 2nd-opinion
-------------------------+--------------------------------------------------
At this moment default theme uses following code to generate <title> tag:
{{{
<title><?php wp_title('«', true, 'right'); ?> <?php
bloginfo('name'); ?></title>
}}}
Other templates uses something similar. Unfortunately this approach does
not allow to completely control the title from plugins, so plugins (mainly
SEO ones) uses output buffering and some kind of string search/replace to
overcome this. This works, but is not good from performance perspective.
Also this may produce unexpected results due to interaction between two
such plugins, when one of them does not handle this correctly.
The easiest approach is to move <title> generation to backend completely,
or pass whole title through new filter in template.
Because SEO plugins calls ob_start() before header.php file is loaded, we
need to develop some kind of mechanism (or extend existing one if exists)
so template can inform others that it supports the new approach. Plugins
could then check this and either register handler for new title hook or
call ob_start(). I think of new function, which should take an associative
array or URI-param-like string. This function will be called from
template's functions.php file.
I can write patch for this. Please let me know what do you think about my
idea, and give me advice which approach should I take to implement the
"template features" mechanism.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10643>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list