Woocommerce 产品副标题错位

Woocommerce product subtitle is misplaced

大家好我希望你能帮助我。 我用 ACF 为我的产品创建了 2 个字幕(字幕和 subtitle_2) 我希望它们出现在我的产品页面和我的 homepage/shop(在产品 "little box" 中)的产品标题下方(duh!!)。

到目前为止,我通过编辑我的 single-product.php 文件设法让它们出现在产品页面上,但它们不在正确的位置,我不知道如何移动他们到我想要的地方。我认为它们被视为页面标题的副标题,而不是产品标题的副标题。 (至于主页,它们根本不出现,但让我们一次解决 1 个问题)

这是我得到的和实际代码:

<?php
/**
 * The Template for displaying all single products.
 *
 * Override this template by copying it to yourtheme/woocommerce/single-product.php
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     1.6.4
 */

 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

 get_header( 'shop' ); ?>

<?php
    /**
     * woocommerce_before_main_content hook
     *
     * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
     * @hooked woocommerce_breadcrumb - 20
     */
    do_action( 'woocommerce_before_main_content' );
?>

<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
    <div id="page-title">       
        <div class="width-container">
            <h3><?php woocommerce_page_title(); ?></h3>
            <?php if(function_exists('bcn_display')) {
                    echo '<div id="bread-crumb">';
                    bcn_display();
                    echo '</div>';
            }?>
        <div class="clearfix"></div>
        </div>
    </div><!-- close #page-title -->
<?php endif; ?>


    <?php while ( have_posts() ) : the_post(); ?>
    <?php the_field('subtitle'); ?>
    <?php the_field('subtitle_2'); ?>

        <?php wc_get_template_part( 'content', 'single-product' ); ?>

    <?php endwhile; // end of the loop. ?>

<?php
    /**
     * woocommerce_after_main_content hook
     *
     * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
     */
    do_action( 'woocommerce_after_main_content' );
?>

</div>

<?php
    /**
     * woocommerce_sidebar hook
     *
     * @hooked woocommerce_get_sidebar - 10
     */
    do_action( 'woocommerce_sidebar' );
?>
    <div class="clearfix"></div>
</div>

这里是 link 对应的产品页面:http://tinyurl.com/pzum42k

任何帮助将不胜感激!! 提前致谢, G

与其在 single-product.php 中回显它们,不如在 content-single-product.php 中回显它们。

换句话说,将 single-product.php 中的内容移至后者。

content-single-product.php中,添加<div class="summary entry-summary">上方的字幕。你想如何设置它们的样式取决于你,但是将它们放在 <p>-tags 中至少会让它们显示在一行中。

这是 content-single-product.php 添加后的片段:

(...)    

<?php echo '<p>' . get_field('subtitle') . '</p>'; ?>
<?php echo '<p>' . get_field('subtitle_2') . '</p>'; ?>

<div class="summary entry-summary">

(...)