Ticket #4407 (closed enhancement: fixed)
Integrate Optimal Title
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | Optimization | Version: | |
| Severity: | normal | Keywords: | has-patch 2nd-opinion |
| Cc: | cpoteet, docwhat, ryan |
Description
One of the SEO horrors of the current WP scheme is the title template tag. The Optimal Title plugin does however circumvent this. Can we use such a methodology to create a new template tag or replace the old one?
Attachments
Change History
- Owner changed from anonymous to rob1n
- Milestone changed from 2.4 (future) to 2.3 (trunk)
What I'm thinking is basically another argument for wp_title (right now we've got separator and display) which is an argument string that has order and so on.
Also, it would be nice if, on a 404, the text could be Not Found, or something more useful.
Optimal title could be replaced by this code:
function optimal_title_filter($title, $sep) {
$sections = explode(" $sep ", $title);
array_push($sections, array_shift($sections));
$optimal_title = implode(" $sep ", $sections);
return $optimal_title;
}
add_filter('wp_title','optimal_title_filter',10,2);
This filter would make the normal wp_title() call function in the same way as optimal title 3.0 does. Just add the filter when needed.
@cpoteet: Not my call. I was just offering up code to use if the devs decide to put it in there. :)
- Keywords has-patch added; 2nd-opinion removed
I decided instead of integration the explode/implode in the plugin to add a parameter as rob1n suggested.
Basically, it adds a parameter onto wp_title that determines the location of the separator. Acceptable values are 'right' or 'left' but defaults to it being on the left as it behaves now. The if/else check only looks at whether the separator is placed on the right and moves it.
What do you think?
comment:12
follow-up:
↓ 13
ryan — 4 years ago
Let's just change the default.
comment:13
in reply to:
↑ 12
cpoteet — 4 years ago
- Cc ryan added
Replying to ryan:
Let's just change the default.
So, should we scrap the parameter and just switch the ordering? Let me know Ryan, and I'll make the change.
comment:14
ryan — 4 years ago
Yes, scrap the parameter and switch the ordering. It's a better default.
comment:15
follow-up:
↓ 16
ryan — 4 years ago
Actually, after looking at how various themes use wp_title(), we probably can't change the default. So, I think we can go with your current patch.
comment:16
in reply to:
↑ 15
cpoteet — 4 years ago
Replying to ryan:
Actually, after looking at how various themes use wp_title(), we probably can't change the default. So, I think we can go with your current patch.
Ya, that's why I figured to keep the default as the legacy position. Maybe in a future release we could switch it indefinitely.
Thanks Ryan!
comment:17
ryan — 4 years ago
- Owner changed from cpoteet to ryan
- Status changed from assigned to new
comment:18
ryan — 4 years ago
- Status changed from new to closed
- Resolution set to fixed
comment:19
drhallows — 4 years ago
Nice! This will replace the use of plugin optimal title Thanks you so much!


+1