[wp-hackers] Forcing Pages to use File Extensions

skipcollege skipcollege at gmail.com
Thu Dec 28 18:21:04 GMT 2006


This useful hack is near complete and working, however it is currently being
applied to both wordpress pages and posts. I simply need it to only be
applied to pages and not posts.

 

Without the hack applied my pages show up at domain.com/pagename (incorrect)
and my posts show up at domain.com/2006/12/postname.html (correct).

 

With the hack applied my pages show up at domain.com/pagename.html (correct)
and my posts show up at domain.com/2006/12/postname.html.html (incorrect).

 

A .html is added to both pages and posts. I only want to add another .html
to pages, not posts.

 

The hack is simply adding $req_uri = preg_replace("|.html$|", '', $req_uri);
to line 1522 in includes/classes.php after $req_uri =
preg_replace("|^$home_path|", '', $req_uri);.

 

It seems to me that the solution is just coming up with a simple php if
statement to wrap around the extension hack that checks if the current
webpage being viewed is a page or not?

 

I've been trying for countless hours without any forum help to come up with
a simple if statement that checks if it is a page or not in
includes/classes.php.

 

I've guessed by trying different variations of this... if ( $this->is_page =
true ) { $req_uri = preg_replace("|.html$|", '', $req_uri); }

 

Could someone here help me write this if statement?

 

Here is a forums post that describes this further...
http://wordpress.org/support/topic/75826?replies=20#post-476547

 

The full topic is here... http://wordpress.org/support/topic/75826

 

Thank you!



More information about the wp-hackers mailing list