WordPress Website Architecture Guide for SEO

 

WordPress is the most widely used blogging platform and I have been using it for god knows how long. Though it is an awesome CMS but then like any other CMS can be prone to errors and bugs.

I have faced several issues with wordpress over the years and have documented solutions to the issues which pop up time and again so that I don’t need to search each and every forum on the web or consult a developer every time I encounter an issue.

By the time you end up reading this post, you should have a better great understanding of the technical side of wordpress which will help you a lot in an optimizing a WordPress website for SEO.

 

Understanding the WordPress Site Architecture

Half of the wordpress optimization battle is won if we know what we are doing in the first place and understand its consequences.

Therefore it is imperative to understand how a wordpress site works and is structured. Without this knowledge you will have a hard time troubleshooting any wordpress issue.

Wordpress Site Architecture

Every wordpress installation comes with a default theme.

You can either use this theme or you can use a custom theme. In either case,

A wordpress theme consist of template files, style sheet files, javascript files, image files and some other files like functions.php.

All these files work together to create the design and functionality of your wordpress website.

All the wordpress themes’ files live in the folder: /wp-content/themes/.

For e.g. all the files associate with the theme named ‘mystique’ resides in the folder: /wp-content/themes/mystique/

Template files are PHP files (.php) which are used to generate web pages and which makes customization possible in wordpress.

The more template files your theme has got, the more customization you can do.

Some template files are used on all the web pages (like header and footer template file), while others are used only under specific conditions.

WordPress decides which template files to load when, according to the template hierarchy rules.

Note: The actual name of a template file can vary depending upon the theme you are using.

 

Understanding the functionality of the most common template files used in WordPress

Following are some of the commonly used WordPress template files which you must be aware of:

header.php

  1. This file display headers and navigation.
  2. If you want to make changes to the head section(<head>…</head> of each web page (like adding the Google Analytics Tracking Code or other tracking code etc) then you need to edit this file.
  3. You can edit the file by going to your WordPress Admin Panel > Appearance > Editor > header.php

Index.php

  1. This template file is used to display the blog post index.
  2. The blog post index contains a loop (bunch of PHP code) which displays the most recent blog posts according to some predefined conditions. It displays a list of posts in excerpt or full-length form.
  3. The blog post index can be set to display on the front page of your website or on a separate static page.
  4. You can edit this file via your wordpress admin panel > Appearance > Editor > index.php or Settings > Reading.

 home.php

  1. This template file can also be used to display the blog post index.
  2. The blog post index can be set to display on the front page of your website or on a separate static page.
  3. If this file is missing then wordpress looks for a file called index.php in the active theme’s directory & uses that template to display the blog post index.

Front-page.php

  1. This template file displays your website’s front Page (which is usually called the home page). The front page can be a static page or a blog posts index.
  2. WordPress searches for this file first when you load the front page of your wordpress website. If this file is missing then wordpress looks for a file called home.php. If home.php is also missing then wordpress looks for a file called index.php and uses that template to display the front page of your website.

page.php

  1. This template file displays page title and its contents.
  2. If you are a logged in user with ‘edit’ permission than this file displays the ‘Edit’ link through which you can edit the contents of a page.
  3. It also display comment list and comment form.

single.php

The template file displays:

  1. blog post’s title
  2. blog post’s content
  3. author name
  4. date of the post
  5. post category & tags
  6. comment list
  7. comment form
  8. Navigation links to the previous and next posts.
  9. If you are a logged in user with ‘edit’ permission than this file displays the ‘Edit’ link through which you can edit the contents of your blog post.

category.php

 This template file controls how categories should be displayed.

author.php

This template file controls how an author page should be displayed

search.php

  1. This template file controls how a search result page should be displayed .
  2. It can display list of posts in excerpt or full length form.
  3. Edit this file if you want to customize your search result page.

404.php

  1. This template file is used when wordpress cannot find the post or page which is queried.
  2. Edit this file if you want to customize your 404 page.

footer.php

Edit this file to change the footer of each web page on your site. Many times we need to add tracking code or some javascript just before the </body> tag or edit footer links. Use this file for such purpose.

comments.php

This template file decides how the comments should be displayed. It also displays trackbacks, pingbacks & gravatars.

style.css

  1. This is the main style sheet file of your wordpress theme and is used to control the design and layout of your web pages.
  2. You can also edit this file to change the theme name, author name or author URL.

Sidebar.php

  1. This template file is used to control the sidebar display.
  2. You can set up the contents of the sidebar widgets through the WordPress admin panel.

Functions.php

  1. This file is used to add your own custom features to your theme. It works like a plug-in file.
  2. Since this file is theme specific, you lose the custom functionality once you change your theme.
  3. Not all wordpress themes use this file.
  4. If this file doesn’t come with your theme, then you can create it under the wp-content/themes/yourThemeFolder and add PHP functions to it.

 

Understanding the functionality of WordPress installation files & folders

These are the files which are unique to a particular wordpress installation and contain all of your website data.

So if you want to take a backup of your WordPress website then take backup of the following installation files and folders.

/wp-content/

This folder contains all of your plug-ins and themes. It also contains all of your blog posts and comments (in the ‘cache’ sub-folder). So if you want to take a back up of your wordpress site then first take a back up of this folder.

/wp-config.php

This file stores your database information like database name, database username, database password etc. It is a very important file and can easily take down your website. So don’t mess with it unless you know what you are doing.

/.htaccess

Another important file for server access control. You can find this file in the root folder via your FTP. It is a very important file and can easily take down your website. So don’t mess with it unless you know what you are doing.

/favicon.ico

This is your website favicon file. You can find this file in the root folder via your FTP.

/robots.txt

Do we need an explanation here?

Now let us move to the advanced stuff, the practical side of things and determine how this knowledge can be used to troubleshoot WordPress issues.

Here I present to you the most common wordpress issues I have encountered over the years and how I deal with them:

 

Issue #1- How to fix ‘error establishing a database connection’ in wordpress?

This error occurs when you change your database password but do not update your wp-config.php file or vice versa.

Solution: If you change your database password then you also need to update your wp-config.php file (which is located in the root directory /html in FTP file manager).

If you don’t update your wp-config.php file then you will get the error message ‘error establishing a database connection’.

Open your ‘wp-config.php’ file via FTP and locate the section that looks like this example:

/* The name of the database for WordPress */
define(‘DB_NAME’, ‘putyourdbnamehere’);
/* MySQL database username /
define(‘DB_USER’, ‘usernamehere’);
/* MySQL database password /
define(‘DB_PASSWORD’, ‘yourpasswordhere’); <=Update your database password here
/* MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

 

Issue #2 : How to fix the error: “It looks like this is a web page, not a feed”?

I have got this error several times. This error usually occurs when permalinks stop working properly.

Solution: To make the permalinks work again: Go to your wordpress admin panel > Settings > Permalinks > click on ‘save changes’ button.

 

Issue #3: RSS feed is showing only one item

Solution– Make sure that the feed URL (like http://www.optimizesmart.com/feed/) is correct.

If the feed URL is correct but still your feed is showing only one item, then make sure that your feed is a valid feed via feedvalidator.com

 

Issue #4: WordPress plugin doesn’t work and you can’t remove it through admin panel

Solution– You need to remove the wordpress plug-in via your FTP. Follow the steps below:

1. Access the FTP of your website
2. Locate the folder ‘wp-content’
3. Look for the folder ‘plugins’ and then open it.
4. Select the plugin folder you want to delete and then right click on it.
5. Choose ‘delete’ from the drop down menu.

 

Issue #5: You can’t fix the issue with your current wordpress theme & can’t remove it via your admin panel

Solution– You need to remove the wordpress theme via your FTP. Follow the steps below:

1. Access the FTP of your website
2. Locate the folder ‘wp-content’
3. Look for the folder ‘themes’ and then open it.
4. Select the theme folder you want to delete and then right click on it.
5. Choose ‘delete’ from the drop down menu.

 

Issue #6: Optimizing the speed of your wordpress site

Solution: There are lots of things you can do to optimize the speed of your wordpress site. But it can be really time consuming.

So if you are short of time and you just want a switch which can dramatically improve the speed of your website then install the W3 Total Cache Plugin.

It is one of the highest rated and most useful wordpress plug-in ever developed. It can dramatically improve your website speed.

 

Issue #7: Optimizing pages of your wordpress website for SEO

Solution: I have used several plug-ins for this purpose but the one which stands out all the time is the Yoast WordPress SEO Plugin.

This all-in-one SEO plug-in gives you control over title tags, meta tags, canonical, 404 errors, rich snippets and tons of other wordpress features. I use this plugin for this website.

 

Issue #8: Removing malware from your wordpress website

Solution: This is one of the most common and serious issue we wordpress users face. Here is what I do to keep my website malware free:

1. Use code gaurd. This tool keeps track of all the changes made to your website. If this tool notice that the change in code (like changes to the .htaccess file) can harm the normal functioning of your website, then it sends you an alert. It takes hourly, daily and monthly back up of your website. I use this tool. 

2. Always keep your wordpress version, plugins and them up to date. Upgrade to the latest version. Every new version comes with a security patch and make your website more secure.

3. Take weekly back up of your website.

4. Be cautious while installing a plug-in or a theme. Sometimes plug-ins/themes contain a malicious code which can harm your website.

5. Scan all your documents/softwares for malware before you make them available for download.

6. Only link out to reputed websites as some websites host malware.

7. Use only reputable advertisers as they are generally malware free.

8. Monitor user generated areas of your website like comments section. Un-moderated comments can have links to malicious websites/files.

 


To learn more about removing malware from your wordpress website, check out this post:
 Malware Removal Checklist for WordPress – DIY Security Guide

 

Must have WordPress Plugins

I am not a big fan of plug-ins because they tend to slow down a website. But there are some plug-ins which are so useful that i can’t think of running a site without them. Following is the list of must have plug-ins:

1. Akismet – It protects your blog from comment and trackback spam. Without this plugin you will be bombarded with spam sooner than later.

 2. PS Disable Auto Formatting – It disables wordpress auto formatting by disabling the function ‘auto formatting (wpautop)’ and save <p> and <br /> formatted content. You need this plug-in to get a control on your blog post formating.

 3. W3 Total Cache Plugin – It dramatically improves your website speed and is highly recommended.

 4. WP-touch – It automatically transforms your blog into an iphone application style theme. A must have plug-in if you want your visitors to read your blog through smart phones.

 5. Yoast WordPress SEO Plugin– You need this plugin to easily optimize your wordpress site pages for SEO. Another must have plug-in.

 

Other Posts you may find interesting:

Subscribe to my blog
Join my free newsletter and learn to avoid the analytics mistakes everyone seems to be making over and over again.

 



Subscribe to my YouTube Channel > > >

 

About the Author:

Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from PPC, Web Analytics or Conversion Optimization.

For any question/comment Contact me