在woocommerce,我们可以通过复制woocommerce模板文件夹入主题覆盖模板 - 步在这里给出:LINK如何编辑woocommerce产品页面?
我想是改变woocommerce产品页面的布局。 我无法找到要编辑的模板php文件以更改产品页面布局。例如检查该产品的页面 - PRODUCT PAGE
我想要做的就是把从左边的图像右侧。并将标题放在左侧。像这样的东西。
但我不能找到一个模板PHP文件来做到这一点。我该怎么做才能做到这一点?
在woocommerce,我们可以通过复制woocommerce模板文件夹入主题覆盖模板 - 步在这里给出:LINK如何编辑woocommerce产品页面?
我想是改变woocommerce产品页面的布局。 我无法找到要编辑的模板php文件以更改产品页面布局。例如检查该产品的页面 - PRODUCT PAGE
我想要做的就是把从左边的图像右侧。并将标题放在左侧。像这样的东西。
但我不能找到一个模板PHP文件来做到这一点。我该怎么做才能做到这一点?
你需要去woocommerce \ templates目录,并修改为内容的单product.php或单个产品的文件夹。 以其它方式使用此CSS
.images {
float: right !important;
}
以下是通过代码的方式: 插件\ woocommerce \模板\单品\产品image.php
<div class="images">
<?php
if (has_post_thumbnail()) {
$image_caption = get_post(get_post_thumbnail_id())->post_excerpt;
$image_link = wp_get_attachment_url(get_post_thumbnail_id());
$image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array(
'title' => get_the_title(get_post_thumbnail_id())
));
$attachment_count = count($product->get_gallery_attachment_ids());
if ($attachment_count > 0) {
$gallery = '[product-gallery]';
} else {
$gallery = '';
}
echo apply_filters('woocommerce_single_product_image_html', sprintf('<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_caption, $image), $post->ID);
} else {
echo apply_filters('woocommerce_single_product_image_html', sprintf('<img src="%s" alt="%s" />', wc_placeholder_img_src(), __('Placeholder', 'woocommerce')), $post->ID);
}
?>
<?php do_action('woocommerce_product_thumbnails'); ?>
</div>
插件\ woocommerce \模板\内容 - single-product.php
<div class="summary entry-summary">
<?php
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action('woocommerce_single_product_summary');
?>
</div><!-- .summary -->
老兄,我可能想聘请你在未来的发展工作。我其实在寻找擅长woocommerce和wordpress的人来开展业务。你怎么做btw? – Adam
谢谢,我是专业的大型商业和WordPress WOO商务网站开发人员。如果您觉得这对您有帮助,请投我的答案。 –
如果你不介意编辑模板,但使用CSS。然后我会应用.images {float:right;}。这CSS会达到你想要的.. –