A few WordPress Tricks.

Just a few little tips for WordPress:

If you don’t want the titles of posts to have the » character before them for SEO purposes just use:
< ?php echo trim(wp_title('&amp;raquo;',false), '&amp;raquo; ');?>

I was sick of my index.php being used to display pages, so I added the following to the top of my index.php to force WordPress to use single.php for all pages:

< ?php
if(is_page()){
include('single.php');
exit;
}
?>

I wanted to be able to use javascript in some of my pages so I added the following to my header.php:

< ?php
if(is_page()){
$j = get_post_meta($post->ID, 'header', true);
	if($j != ''){
		echo $j;
	}

}
?>

Now anytime I need special style or javascript code added for a particular page I just add a custom field with the name header.

Have you ever tried to validate your WordPress site to use with Google Webmaster Tools? It can be a pain depending on the way your permalinks are, and even if those don’t cause a problem when Google tries to go to a random URL if the header isn’t 404 then it fails.

Continue reading. »