Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4407 closed enhancement (fixed)

Integrate Optimal Title

Reported by: cpoteet's profile cpoteet Owned by: ryan's profile ryan
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: Optimization Keywords: has-patch 2nd-opinion
Focuses: Cc:

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?

http://elasticdog.com/2004/09/optimal-title/

Attachments (1)

separator-location.diff (902 bytes) - added by cpoteet 17 years ago.

Download all attachments as: .zip

Change History (20)

#2 @rob1n
17 years ago

  • Milestone changed from 2.4 (future) to 2.3 (trunk)
  • Owner changed from anonymous to rob1n

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.

#3 @Otto42
17 years ago

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.

#4 @cpoteet
17 years ago

@Otto: So are you thinking about including it in the trunk?

#5 @Otto42
17 years ago

@cpoteet: Not my call. I was just offering up code to use if the devs decide to put it in there. :)

#6 @cpoteet
17 years ago

  • Owner changed from rob1n to cpoteet

Robin - Going to add this.

#7 @cpoteet
17 years ago

  • Status changed from new to assigned

#8 @foolswisdom
17 years ago

  • Milestone changed from 2.3 to 2.4 (next)

#9 @cpoteet
17 years ago

  • 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?

#10 @docwhat
17 years ago

  • Cc docwhat added

#11 @cpoteet
17 years ago

  • Keywords 2nd-opinion added

#12 follow-up: @ryan
17 years ago

Let's just change the default.

#13 in reply to: ↑ 12 @cpoteet
17 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.

#14 @ryan
17 years ago

Yes, scrap the parameter and switch the ordering. It's a better default.

#15 follow-up: @ryan
17 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.

#16 in reply to: ↑ 15 @cpoteet
17 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!

#17 @ryan
17 years ago

  • Owner changed from cpoteet to ryan
  • Status changed from assigned to new

#18 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6538]) Add separator location arg to wp_title. Props cpoteet. fixes #4407

#19 @drhallows
17 years ago

Nice! This will replace the use of plugin optimal title
Thanks you so much!

Note: See TracTickets for help on using tickets.