]> The LambCutlet Disorganisation » WordPress & “application/xhtml+xml”

The LambCutlet Disorganisation

WordPress & “application/xhtml+xml”

Posted by Jonathan at 23:52:34 UTC on the 24th of September, 2004

Well, well, well… The LambCutlet Disorganisation is back in business with some good old content negotiation and correctly serving XHTML as application/xhtml+xml, it’s correct MIME-type to XHTML browsers; having for the last 4 months or so, always served the XHTML as text/html regardless what the user agent was capable of accepting.

The changes I’ve implimented are just a quick port of what I used to have running when this blog was still hand rolled and they are as follows:

In ./wp-blog-header.php, find…


if ( !isset($doing_rss) || !$doing_rss )	{
	@header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php');
} else {

Replace with…


if((strstr($_SERVER["HTTP_ACCEPT"], 'application/xhtml+xml'))||(strstr($_SERVER["HTTP_USER_AGENT"], 'W3C_Validator'))||(strstr($_SERVER["HTTP_USER_AGENT"], 'WDG_Validator')))	{
	$http_accept_mime = 'application/xhtml+xml';
} else {
	$http_accept_mime = 'text/html';
}
if ( !isset($doing_rss) || !$doing_rss )	{
	@header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php');
	@header ('Content-Type: ' . $http_accept_mime);
} else {

In ./index.php, find…


<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />

Replace with…


<meta http-equiv="Content-Type" content="<?php echo $http_accept_mime; ?>; charset=< ?php bloginfo('charset'); ?>" />

Update the files and anally retentive XHTML loving will be all yours again. :D

Filed under: Meta, Software

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Due to continued annoyance from spam-bots, this site now uses a Captcha. Disabled users can still submit their comments via my contact form.

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Don't forget that this site support Gravatars!

(required)

(required)

Authorisation code image