wordpress产品分类名称显示
wordpress产品分类名称显示
用过wordpress的都应该知道wp-e-commerce这个插件,如果不知道的,现在就知道了.这是一个wordpress管理产品的插件,安装之后会有电子商务的功能,包括编辑产品分类,产品的添加包括(产品名称,图片,图片尺寸,描述,价格等等).当然也有很多的功能要设置.这里就讲用分类名称显示和分面显示.
- 进入wordpress后台,添加好产品分类和相对相的产品之后,点击”设置->store” 在右边选择” Presentation”如下图:
- 下拉右边栏目,找到Show list of categories将其设置为 yes.
- 找到Show Breadcrumbs:设置为yes .这个设置好以后如果你在产品分类栏添加分类图片时,前台的分类名称和图片会一起显示.如果你只想显示图片或分类,小弟改了一下程序,功能是在有分类图片时显示分类图片,没有分类图片时显示分类名称.找到文件wp-e-commercewpsc-includescategory.functions.php中的函数function wpsc_display_category_loop 拉到函数末将
$tags_to_replace = array(‘[wpsc_category_name]’,
‘[wpsc_category_description]’,
‘[wpsc_category_url]’,
‘[wpsc_category_id]’,
‘[wpsc_category_classes]’,
‘[wpsc_category_image]’,
‘[wpsc_subcategory]’,
‘[wpsc_category_products_count]’);
$content_to_place = array(
esc_html($category_row->name),
$category_description,
get_term_link($category_row->slug, ‘wpsc_product_category’),
$category_row->term_id,
$category_classes,
$category_image_html,
$sub_categories,
$category_count_html);
改成:
$tags_to_replace = array(‘[wpsc_category_name]’,
‘[wpsc_category_description]’,
‘[wpsc_category_url]’,
‘[wpsc_category_id]’,
‘[wpsc_category_classes]’,
‘[wpsc_category_image]’,
‘[wpsc_subcategory]’,
‘[wpsc_category_products_count]’);
if($category_image_html!=””)
{
$category_row->name=””;
}
$content_to_place = array(
esc_html($category_row->name),
$category_description,
get_term_link($category_row->slug, ‘wpsc_product_category’),
$category_row->term_id,
$category_classes,
$category_image_html,
$sub_categories,
$category_count_html);保存即可.还可以将分类的位置进行更改. 分类显示的代码在wp-e-commercewpsc-themewpsc-products_page.php 代码如下:
get_option(‘wpsc_default_category’), ‘show_thumbnails’=> 1)); ?>
get_option(‘wpsc_default_category’), ‘show_thumbnails’=> get_option(‘show_category_thumbnails’))); ?>
Over 95% of our clients recommend our language services to others