Ticket #4407 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

Integrate Optimal Title

Reported by: cpoteet Owned by: ryan
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?

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

Attachments

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

Change History

+1

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

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

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

  • Owner changed from rob1n to cpoteet

Robin - Going to add this.

  • Status changed from new to assigned
  • Milestone changed from 2.3 to 2.4 (next)

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

  • Cc docwhat added
  • Keywords 2nd-opinion added

comment:12 follow-up: ↓ 13   ryan4 years ago

Let's just change the default.

comment:13 in reply to: ↑ 12   cpoteet4 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.

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

comment:15 follow-up: ↓ 16   ryan4 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   cpoteet4 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!

  • Owner changed from cpoteet to ryan
  • Status changed from assigned to new
  • Status changed from new to closed
  • Resolution set to fixed

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

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

Note: See TracTickets for help on using tickets.