SEO Tutorial Overview
- Some SEO basics.
- Remove Wordpress headline from “products-page”.
- Add h1 to item/product page.
- Add h1 element to Category/Group pages.
- Title tags and meta descriptions
For those of you just getting your feet wet when it comes to SEO, there are a few basic on-site optimization fundamentals that should never be overlooked, especially if you plan on driving traffic from the search engines in a competitive market. There are three main factors, the title tag, the h1 tag and the inbound anchor text to your page for successful ecommerce seo.
It is important that each page have a unique title tag and h1 tag that closely match (contain the targeted keyword phrase). The h1 tag is often and mistakenly used in the logo and is not unique to each page. In Google’s algorithm, any content in the h1 element is more important than any other content on the page. For more on the H1 tag you can read Scott Hendison’s explanation or checkout this SEO basics article (third step).
Removing The Products Page Headline Title
WP e-Commerce uses the page template in order to display all products. For example, the products-page will contain a list of products that you choose in the setup. When you click on a category/group, that category or group will be displayed inside of the wordpress products-page. It will send a string to the URL so it may look something like: site.com/products-page/test-category
Since the wordpress products-page is always present, the title (headline) for the page will remain no matter what category or product you are viewing and will say “Products Page”. Lets get rid of the page title for the products page so we can use h1 tags that are related to our products.
The Page/Post title is featured above the content and is displayed in the page.php template with something like this (this is your general wordpress theme, not the WP e-Commerce theme):
-
-
<h1><a title="Permanent Link to <?php the_title_attribute(); ?>" rel="bookmark" href="<?php the_permalink() ?>"></a></h1>
-
Lets tell wordpress to display the page title as long as the page is not the “Products Page”.
-
-
<h1><a title="Permanent Link to <?php the_title_attribute(); ?>" rel="bookmark" href="<?php the_permalink() ?>"></a></h1>
-
Not to be confused with what Wordpress calls the “Products Page”, this is the page where your individual products are for sale. For example the page would be:
site.com/products-page/example-category/another-test-product/
In products_display_functions.php on line 645 you will find the following code.
-
$output .= "
-
\n\r";
Change the h2 elements to h1 elements.
-
$output .= "
-
\n\r";
You will need to play around with the stylesheet to get the look you want, I am not going to go to in depth into the design process here. But, In the iShop.css, look for h2.prodtitles and create another style with h1.prodtitles. If you use the same attributes, will get the same look as the h2 elements.
H1 Element On The Categories/Groups Page
You will need to edit the core WP e-Commerce files in order to get the h1 element included at the top of the categories pages. The category pages are sometimes referred to as group pages. It is important to name them with the proper keyword that you are targeting.
Open products_page.php in your favorite text editor. You will find the following code starting at line 63.
-
if($_GET[‘product_search’] != null) {
-
echo "<strong class="cattitles">".TXT_WPSC_SEARCH_FOR." : ".stripslashes($_GET[‘product_search’])."</strong>";
-
} else {
-
$category_image = ”;
-
if((get_option(’show_category_thumbnails’) == 1) && ($category_data[‘image’] != null)) {
-
$category_image = "<img class="category_image" src="".WPSC_CATEGORY_URL.$category_data[" alt="" />";
-
}
-
echo "".$category_image."<strong class="cattitles">".stripslashes($category_data['name'])."</strong>";
-
On line 64 replace the strong element with the h1 tag. Remember to replace the closing tag with it is well and leave the class=”cattitles” the same. Do the same thing on line 70 since it is an if/else statement.
This is how the code should look after you are done (you could just copy and paste if you like).
-
if($_GET[‘product_search’] != null) {
-
echo "
-
";
-
} else {
-
$category_image = ”;
-
if((get_option(’show_category_thumbnails’) == 1) && ($category_data[‘image’] != null)) {
-
$category_image = "<img class="category_image" src="".WPSC_CATEGORY_URL.$category_data[" alt="" />";
-
}
-
echo "".$category_image."
-
<h1 class="cattitles">".stripslashes($category_data['name'])."</h1>
-
";
-
Title Tags And Meta Descriptions
I built this script based on this one, I modified it to include a title tag for the products page itself. I also added the meta description capabilities.
The category pages function determines that it is indeed a category page, queries the database for the category name and puts it into the title tag. It also takes the first 150 characters of the category description and puts it into the meta description tag
The item (actual product) pages function does the same thing as the category pages function, except that it makes sure you are on the product page. It replaces the title tag with the product name and blog info (you need to edit script to put your blog info in). It also includes the first 150 characters of the first description in the meta description tag.
The title tag and meta description for the main products page(products-page) is added manually when you install the script. Simply, replace, “My Products Page Title” with the appropriate title tag.
I normally use a plugin to add the meta description tag, but that plugin conflicted with WP e-Commerce. So I am using SEO Title Tag and wrote the next part of the script to add the description tag. Basically, it simply adds the description tag to every page that is not on the products page by adding the first 150 characters of the post.
This goes into the main Wordpress header template where your normal title tag would go.
-
".$productname." | site name
-
";
-
}
-
///////// Function to Find Category Name /////////////
-
function oGetCategoryName( $nicename ){
-
global $table_prefix;
-
$query = "SELECT name, description
-
FROM ".$table_prefix."product_categories
-
WHERE `nice-name` = ‘".$nicename."’";
-
$result = mysql_query( $query );
-
$row = mysql_fetch_array( $result );
-
$name = $row['name'];
-
$description = $row['description'];
-
//Category Title Tag and Description — Change the name below to reflect your site
-
return "".$name." | site name
-
";
-
}
-
//this if state will determine if we are on the products page, the category page or the actual products page (item page) and call the appropriate function
-
if(get_the_title() == ‘Products Page’ ){
-
$pparts = explode(’/', trim($_SERVER['REQUEST_URI'],’/') );
-
if( $pparts[2] != ” ){
-
echo oGetProductName( $pparts[2] );
-
}
-
else if( $pparts[1] != ” ){
-
echo oGetCategoryName( $pparts[1] );
-
}
-
//if we make it this far in the if statement, than we know that we are on the main products-page listing what you have for sale, manually edit this to reflect what you want the title tag to be and what description you want to use.
-
else {
-
?> your title tag for home
-
-
<?php if (function_exists(’seo_title_tag’)) { seo_title_tag(); } else { bloginfo(’name’); wp_title();}
-
?>
-
Alright, you should be well on the way to a nicely optimized WP e-Commerce site.
thank you good
January 22, 2009
I am glad you found it useful.
hey. i think the beginning of the title tag code is missing, isn´t it?
also, the two pieces of code for “Removing The Products Page Headline Title” are identical
Replacing the h2 tag with a h1 is indeed a cunning idea (as would the Blackadder say (this is from a British comedy series)) But indeed, we all should look into our templates to see whether there are these kind of little optimisations can we could profit from.
Thanks for the good advice.
great tutorial. i used it. thank u
Great,Thank you!
For keywords and description meta attributes,I like to use all-in-one-seo plugin,That’s great!
Brilliant little summary - thank you for sharing. I’m using AllInOneSEO plugin for meta and page titles too with no problems spotted yet.
The two snippets of code above for removing Products Page Headline Title are the same, as Tobias points out - I’d love to see that corrected if you have a spare minute. I don’t know how to write an if statement (?) to determine if it is the products page or not so might just strip all that code out for the time being!
February 27, 2009
Sorry for the delay…I have updated both errors.
hey jason. thanks for the update, but i´m still getting an unexpected t_string error when Removing The Products Page Headline Title your way
same for the meta-tag-fix. using wp 2.7 and wp ecommerce 3.6.8 rc 3
March 2, 2009
@Tobias, I will post my complete header.php file for you to download later. I am not sure why you are getting the error and I will take a look at it.
Tobias - have you perhaps renamed your products page?
March 7, 2009
you should offer a paid service to do this. i could use the help. having nothing but problems with 2.7.1 :0(
beautiful blog merciiii
I am using all in one seo and wpremix for my blog them and I cannot change my header.php title tag. Is there any way this company is going to produce a plugin with built in seo features???
SEO can be a daunting task to begin with, but adding SEO to an ecommerce site is even more difficult. I think you offer some great tips that everyone should take advantage of. Thanks for the write up!
I have been having a ton of trouble getting my online store that uses wp e-commerce indexed properly. it gets very few visitors a day. your post makes alot of good points. im gonna implement just about everything you say here. ill let you know hoe it goes.
You offer great tips. H1 tags are very important, what i think people forget is the fact that it should only be used one time per page. Use H2 or H3 tags if you need to, but using too many H1 tags is like bolding your entire paragraph… it looses its emphasis.
May 20, 2009
In Fact, I am getting the t_string error as well. Would be great otherwise to have this code running well in my wp header.php file. I tried several times to paste this into my original header from wp default theme, 2.7.1 WP. Any editing to this php code please? I am otherwise all right to do such changes but in these regards it’s not working. With compliment and anticipation. Thank you very much!!!
Cool tutorial. help me very much.
Hi,
I’m just new in this SEO thing. what is WP-e? I just bookmarked your website. hope to get an answer. thanks!
well put together and very useful. Since fixing numerous sites using your guide we were able to see a jump in rankings for multiple websites. Duplicate descriptions and titles is a major issue for seo. Well done
June 7, 2009
Having trouble with both my sites using this.
Unexpected T string.
Any help?
Please email me.
June 7, 2009
Can’t get this to work.
Unexpected T string.
I have 2 sites and get same error, can anyone help me?
Getting this error
Parse error: syntax error, unexpected $end in /home/cultcine/public_html/wp-content/themes/Black_Wood_0_1_1923/header.php on line 194
Line 194 has no code, so what’s the problem??
My products page is named (products-page) for some reason
and the code above doesn’t get rid of it in URL.
Can you please email me and help me out on this.?
Hi, i am trying to add all products and related pages with products to sitemap.
i m using google-sitemap-generator plugin and wp-e-commerce plugin.
i can add manually all products to sitemap but i want to do it with codes.
do you have any idea?
Missing a } at the end.
I haven’t figured out how to get descriptions working on a product page yet though.
thanks, it is usefull tutorial…
Thank You
Replacing the h2 tag with h1 sounds interesting. I will have to try it on one site and see how it effects search results for site. Some great ideas i am going to try one at a time on different sites.
Hi, I am trying to fix a silly problem in e-commerce where the meta tag for description says “[productspage]”
You didn’t mention this so I was wondering if following your changes will add a good description to each product.
Also when I try and copy/paste your code I get a number sign for each line.
Could we get it in a plain text file for easy copying.
Great article, thanks for your help.
Hi,
Is there a WP e-commerce theme that you would recommend that’s great for SEO and all ready has some of the info above in it?
July 30, 2009
@Michelle, I do not. You will have to manually change the CSS files and HTML to make the themes SEO’d
Thanks for accompanying your code as well… it was easier to follow than other posts
September 1, 2009
syntax error also here….
does anybody have the correct version of scripts above?
I wonder why Jason have been so kind to spend his precious time in this post with so many interesting arguments for then leave it unusable for the people. (expecially for who uses latest releases where several files and paths have been changed)
It sounds to me so odd……
September 2, 2009
Mario…my fascination with wp-ecommerce is over. I have now switched all of my ecommerce to Magento. However, I do plan an addon soon to customize your seo stuff for wp ecommerce.
maybe I can use that
This is one of the best tutorial on optimizing the WP e-commerce!
Thanks!
It really surprised me in that thread that Dan from WPecommerce asked what a SERP was. If a WP programmer had even a little bit of SEO knowledge, we wouldn’t have to be modifying the php code. It would be built in.
I can’t even get any of the Sitemaps plugins to work on my site. Apparently product pages are built at runtime, which conflicts with the normal WP standard that makes nice looking sitemap pages.
Has anyone had success with a Sitemap and WPecommerce, or have a mod that makes them work. My sitemap indexes 5 pages of my whole site: Home, Checkout, About, Transaction Results, Your Account.
Thanks for the great article!
October 16, 2009
@Bryan,
Ye….what are SERPS? Just kidding. That is actually kinda scary. I do not know of anything that would work for the sitemaps.
I would like to put together a group of developers to come up with a completely viable ecommerce option for wordpress.
Hi. Your entry was very helpful, to those who are working hard in increasing traffic, and dealing with seo. This could really help those beginners. I enjoyed reading it. This would be of help to me.
Anyway, do you know the next Google PR update?
Thanks. Nice website you got here..
December 28, 2009
Hi there
Thanks for providing these tips!
I have looked and looked and the ‘Removing The Products Page Headline Title’ code still seems to look the same in the before and after?
Also, does Magento work with WordPress or is it a stand alone e-commerce where you build the website and the shopping cart in one?
remember folks not to use more than 1 h1 tag per page - i quite like “all in one seo pack” - allows you to manually enter seo info per page
It is cool, i have never mentioned css before, thanks for your guide.
Comments RSS TrackBack Identifier URI
Leave a comment













44 Comments