SEO Title Tags for Shopp

Shopp’s default title tags are fine, but get down to some hard core SEO tuning, they simply don’t cut it.

Here’s some code I lifted and modified from the Shopp forums to make the title tags SEO friendly.

See http://forums.shopplugin.net/topic/customizing-catalog-page-titles-please-help for more info.

Put the following code in your current theme’s functions.php

function shopp_catalog_titles($title,$sep=' ') {
	global $Shopp;
 
	$titles = array();
 
	if (shopp('catalog','is-category')) {
		if (!empty($Shopp->Category->name)) {
			$titles = array($Shopp->Category->name);
		}
	}
	else if (shopp('catalog','is-product')) {
		if (shopp('product','has-categories')) {  // Use category name, if available
 
			$titles = array($Shopp->Product->name, $category);
		} else { // Category not available, just the product name
 
			if (!empty($Shopp->Product->name)) {
				$titles = array($Shopp->Product->name);
			}
		}
	}
	if (empty($titles)) {
		$titles = array($title, '');
	}
 
	return join($sep,$titles);
}

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

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