Home » Labs » Dynamic post title for WordPress site  

Dynamic post title for WordPress site


Filed under Labs

You can create titles dynamically by adding following code to your header.php file WordPress theme.

 
<title>
	<?php
	  if (is_home()) { echo bloginfo('name');
		  } else if (is_404()) {
					   echo '404 Not Found';
		  } else if (is_category()) {
					   echo 'Category:'; wp_title('');
		  } else if (is_search()) {
					   echo 'Search Results';
		  } else if ( is_day() || is_month() || is_year() ) {
					   echo 'Archives:'; wp_title('');
		  } 
	else {
			echo wp_title('');
		  }
	?>
</title>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook

Posts you may like: