WordPress Page Title php Code

wp_title_thumb

Generate custom titles for the wordpress pages using php code. Title for the landing or homepage , tags page, post page etc. can be generated using this code. This code needs to be added to the header.php file.

<?php 

if (function_exists('is_tag') && is_tag()) { 

	echo 'Tag Archive for &quot;'.$tag.'&quot; - '; 

} elseif (is_archive()) { 

	wp_title(''); echo ' Archive - '; 

} elseif (is_search()) { 

	echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; 

} elseif (!(is_404()) && (is_single())) { 

	wp_title(''); echo ' - '; 

} elseif (is_404()) {

	echo 'Not Found - '; 

}
bloginfo('name'); 

?>

</title>

About the Author: smartcoder

Leave a Reply

Your email address will not be published. Required fields are marked *