Automatic SEO Titles for all pages in Wordpress

2Fast2BCn

New member
Joined
May 27, 2016
Messages
10
Points
0
Your page title is one of important factors that the robot's search engines like finding and make your webpages rank higher others on search engines results. Most of wordpress themes by default are configured according to one standard header, it works very well for normal pages, but the pages displayed as search results, 404, archives are not showing well, in this post I will show you how to fix the title so that it displays suitable titles for all pages in Wordpress.

Here is a list of titles that you plan to create as following:

– Home Page – Blog Name | Blog Description
– Search Results – Search Results for search terms – 11 Articles | Blog Name
– 404 (Error) Page – Blog Name | 404 Nothing Found
– Author Archives – Blog Name | Author Archives
– Single Post – Post Name | Category Name | Blog Name
– Page – Page Name | Blog Name
– Category Page – Category Name | Category Description | Blog Name
– Monthly Archive – Blog Name | Archive | Month, Year
– Day Archive – Blog Name | Archive | Month Day, Year
– Tag – Tag Name | Blog name
Step 1: Open the file header.php in your folder theme and find text that looks like the following text:

Code:
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
Step 2: Replace the above code with the following code here:

Code:
<title> <?php if ( is_home() ) { ?><?php bloginfo('name'); ?> | <?php bloginfo('description'); ?><?php } ?>
<?php if ( is_search() ) { ?>Search Results for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); echo $key; _e(' — '); echo $count . ' '; _e('articles'); wp_reset_query(); ?><?php } ?>
<?php if ( is_404() ) { ?><?php bloginfo('name'); ?> | 404 Nothing Found<?php } ?>
<?php if ( is_author() ) { ?><?php bloginfo('name'); ?> | Author Archives<?php } ?>
<?php if ( is_single() ) { ?><?php wp_title(''); ?> | <?php
$category = get_the_category();
echo $category[0]->cat_name;
?> | <?php bloginfo('name'); ?><?php } ?>
<?php if ( is_page() ) { ?><?php bloginfo('name'); ?> | <?php
$category = get_the_category();
echo $category[0]->cat_name;  ?>|<?php wp_title(''); ?><?php } ?>
<?php if ( is_category() ) { ?><?php single_cat_title(); ?> | <?php $category = get_the_category();
echo $category[0]->category_description; ?> | <?php bloginfo('name'); ?><?php } ?>
<?php if ( is_month() ) { ?><?php bloginfo('name'); ?> | Archive | <?php the_time('F, Y'); ?><?php } ?>
<?php if ( is_day() ) { ?><?php bloginfo('name'); ?> | Archive | <?php the_time('F j, Y'); ?><?php } ?>
<?php if (function_exists('is_tag')) { if ( is_tag() ) { ?><?php single_tag_title("", true); } } ?> | <?php bloginfo('name'); ?>
</title>
You try to save and check the results.

Hope it helps!
 
Older threads
Replies
0
Views
2,102
Replies
3
Views
3,105
Newer threads
Recommended threads
Replies
4
Views
3,751
Replies
3
Views
2,793
Replies
2
Views
2,726
Replies
34
Views
19,549

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top