Make Your Titles Shorten Then Now!

Some people use extremly long titles for their blog. Also you can use titles like that. There is a way to make short titles for SEO. I will give to you this quick and simple function to make this. Let’s begin…

Here is The Code;

Add this function into your theme’s functions.php.

function short_title($after = '', $length) {
	$mytitle = explode(' ', get_the_title(), $length);
	if (count($mytitle)>=$length) {
		array_pop($mytitle);
		$mytitle = implode(" ",$mytitle). $after;
	} else {
		$mytitle = implode(" ",$mytitle);
	}
	return $mytitle;
}

After this you can use this simple function for show your titles shorten then now. You can add this lines into your index.php or where you want!

<?php
// short_title($after, $length)
echo short_title('...', 10);
?>

That’s all. Have a nice day.


Related posts:

If you enjoyed this post, make sure you subscribe to my RSS Feed

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
 

Highslide for Wordpress Plugin