更新时间:2021-08-18 06:22:19
如果您使用任何woocommerce兼容模板,那么你会在模板文件夹中找到一个名为woocommerce的目录。
If you use any woocommerce compatible template then you'll find a directory named "woocommerce" in your template folder.
如果您找不到,则会是 wp-contents / plugins / woocommerce / templates
目录。在这种情况下,您的主题不会覆盖默认布局。然后你需要找到模板(或woocommerce)/single-product/product-image.php
文件。在第21行你应该找到如下 -
If you can't find it then it'll be the wp-contents/plugins/woocommerce/templates
directory. In that case your theme doesn't overwrite the default layout. Then you need to find templates(or woocommerce)/single-product/product-image.php
file. Around line 21 you should find something as following-
$image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
在该行添加// infront(注释掉),如下 - 。
add // infront of that line (comment that out) as follows-.
// $image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
现在搜索 rel =prettyPhoto
在 rel =prettyPhoto
的 title =%s
在上一个文件夹中再次找到 product-thumbnailails.php
。在40左右,你会看到如下的一些东西 -
Again find product-thumbnails.php
in the same folder of the previous one. In around 40 you'll see something as follows like before-
$image_title = esc_attr( get_the_title( $attachment_id ) );
注释,添加两个正斜杠(//)就像上一个。
现在再次在第42行搜索 prettyPhoto [product-gallery]
,当你找到 title =%s
附近,并像之前一样删除。
Comment this out adding two forward slashes(//) just like the previous one.
Now again in around line 42 search for something prettyPhoto[product-gallery]
and when you find it look for title="%s"
nearby and remove it like before.
这会移除灯箱图片查看器中的标题。
This will remove the title form the lightbox picture viewer.
这下面的脚本在你的header.php文件或任何你可能找到合适 -
Instead of all these works you can simply use this following script inside your header.php file or anywhere you may find suitable-
<script>
jQuery(document).ready(function(){
jQuery('a[rel*="prettyPhoto"]').attr('title','').find('img').attr('alt','');
});
</script>