php - WooCommerce - 产品图像模板 - 更改目录路径图像
问题描述
我想更改图像的目录路径。当前的 product-image.php woocommerce 模板是:
<?php
if( has_post_thumbnail() ) {
$image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );
$image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
$image_link = wp_get_attachment_url( get_post_thumbnail_id() );
list( $magnifier_url, $magnifier_width, $magnifier_height ) = wp_get_attachment_image_src( get_post_thumbnail_id(), "shop_magnifier" );
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image" title="%s">%s</a>', $magnifier_url, $image_title, $image ), $post->ID );
} else {
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image"><img src="%s" alt=" ' . esc_attr__( 'Placeholder', 'jico' ) . ' " /></a>', $placeholder, $placeholder ), $post->ID );
}
?>
如何自定义%s
in img src="%s"
?
有人可以帮助我获得一些方向吗?
解决方案
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
echo $image[0]
推荐阅读
- java - cmd上的java编译问题(json简单)
- html - 如何在ionic3中的标签图标上添加一个点?
- eclipse - 启动 Eclipse 时出现“init exec 提供程序默认位置”错误
- python - 如何用sympy获得偏微分结果的系数
- node.js - 有没有办法使用 Cheerio 库捕获/抓取整个表格而不是逐个单元格?
- javascript - 如何更改 material-ui 中选定 MenuItem 的文本颜色?
- angular - 角度 9 keyPress 事件
- azure - Azure 工作簿 - 自动刷新和导入/导出选项
- flutter - 如何从 Flutter 中的 AssetImage 获取图像文件名?
- php - 在另一个 isset 函数中调用 isset 函数