给Google"喂"数据(下)

上一期通过修改源码的方式解决了Missing field "aggregateRating"和Missing field "review"两项,后来在谷歌后台检测网站时又发现Missing field "hasMerchantReturnPolicy" (in "offers")和Missing field "shippingDetails" (in "offers"),总是修改源码不是好的办法,今天把woocommerce网站翻了个遍,终于找到了可以修改Structured Data的hooks了。

1、修改系统现有的Structured Data

1
2
3
4
5
6
add_filter( 'woocommerce_structured_data_product', function( $schema, $product ) {
$schema['name'] = 'Your new products name here';
$schema['description'] = 'Your new products description here';
$schema['image'] = 'Link to your new product image here';
return $schema;
}, $priority = 20, $accepted_args = 2 );

没错,就是这个filter:woocommerce_structured_data_product!

Read more

给Google"喂"数据(上)

Woocommerce 开发小组比较倔强,明明谷歌已经提示要改善数据了,但是默认的Woo还是不改;这次为了能达到谷歌的要求,不得不对源码下手了,虽然知道改源码的风险很大,但是还是要改,涉及到推广的事情就必须要去做,尽管可以通过hook来实现,但是本人认为改动太大了。下面是我就Missing field "aggregateRating"和Missing field "review"两项做的改动;

1、class-wc-structured-data.php修改

找到文件中下面的位置

Read more

Woocommerce 自定义SEO

WordPress + Woocommerce 是世界上用得最多的电商开发工具,但是设置上总是不能满足我们多样的需求,接下来,我将从订制的角度来阐述如何如何给产品增加meta标签,并用meta标签实现给Google喂数据,从而满足Google对产品搜索要求。

1、在woocommerce后台增加SEO选项卡

Read more