Custom Post Types for SEO
Search engine optimization (SEO for short) is probably the single-most important aspect of a good website. Having a nice looking website is great, but if no one can find your website then it might as well not be online at all.
Search engines are robots which do their best to understand and categorize the content of web pages. This is accomplished by looking at the title of the page, the keywords contained within the page content, and the URL of the page. How each search engine ranks a page is a secret, but through research and testing we have discovered some tricks to improve your search engine ranking.
Wordpress was originally designed as a blogging platform, and over the years has evolved into a full featured content management system (CMS for short). In its most basic form, WordPress has two different types of content: Posts, and Pages. Using these two post types a full featured website can be created, however this has two major shortfalls. First of all, using only these two post types will mean that the administration panel will become cluttered as content is added. Not a huge issue, more of an inconvenience. Where this built in functionality falls flat on its face is in the URL structure. By default, all ‘Posts’ will simply be placed as a top level URL, not unlike this very post you are currently reading. For blog or news posts, this works fine, but what if we want to list a number of products or services?
By using a custom post type, we can organize things into a more logical structure, which in turn will help search engines to determine what the content relates to. This also creates another menu in the administration panel to help keep things organized. On this website, we use a number of custom post types such as ‘Services.’ Notice how the URL for each service is preceded with /services/ as in this link: https://athielmarketing.com/services/graphic-design/
Creating custom post types is easy, and will make your life easier. Below, I will demonstrate how post types are created and used in the real world.
[code language=”php”]
array(
‘name’ => __( ‘Products’ ),
‘singular_name’ => __( ‘Product’ )
),
‘public’ => true,
‘has_archive’ => true,
‘supports’ => array(
‘title’,
‘editor’,
‘thumbnail’
)
)
);
}
?>
[/code]
Placing this code into your theme’s functions.php file will create a post type called ‘Products’ with a URL starting with /products/ which supports posts with a title, content editor, and featured image. For a comlete list of arguments see this page of the WordPress Codex.
Pulling back the data for the post type is easy. Simply create a template file for the archive, and name it archive-products.php and a template for the post and name it single-products.php then update your permalink structure. At this point, navigating to http://www.yourwebsite.com/products/ will display your products archive, and navigating to http://www.yourwebsite.com/products/example-product/ will display your post. Creating a template file goes beyond the scope of this post but you can probably simply copy the existing single.php file and archive.php file to create a layout which works, although every theme is different.
If your search engine ranking needs help, contact us today and we can create a strategy that works for you.
Categories
Recent posts
- WordPress / PHP Web Developer/Programmer Chatham Ontario Job Vacancy July 28, 2014
- Don’t be a victim of blackmail June 30, 2014
- Buying Links For Your Website To Help SEO April 22, 2014
- Domain Registry of Canada Requests – SCAM July 30, 2013
- Customizing the Admin Panel CSS (The Smart Way) July 03, 2013