首页 > 解决方案 > single-product.php woocommerce中有一条通知,图片在描述中

问题描述

注意:没有 comments.php 的主题自 3.0 版以来已被弃用,没有可用的替代品。请在您的主题中包含一个 comments.php 模板。在 /--/--/--/--/wp-includes/functions.php 第 3984 行。

single-product.php woocommerce 文件中有一个通知,我看到评论列表但有这个通知

我还在我的主题中添加了comments.php

主题中的这个 comments.php 文件

<?php
 /*
 * If the current post is protected by a password and the visitor has not yet
 * entered the password we will return early without loading the comments.
 */
 if ( post_password_required() )
    return;
?>
 <div id="comments" class="comments-area">
    <?php if ( have_comments() ) : ?>
        <h2 class="comments-title">
            <?php
                printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'ivanhoe' ),
                    number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
            ?>
        </h2>
        <ol class="commentlist">
            <?php
                wp_list_comments( array(
                    'style'       => 'ol',
                    'short_ping'  => true,
                    'avatar_size' => 74,
                ) );
            ?>
        </ol><!-- .comment-list -->
        <?php
            // Are there comments to navigate through?
            if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
        ?>
        <nav class="navigation comment-navigation" role="navigation">
            <h1 class="screen-reader-text section-heading"><?php _e( 'Comment navigation', 'ivanhoe' ); ?></h1>
            <div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'ivanhoe' ) ); ?></div>
            <div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'ivanhoe' ) ); ?></div>
        </nav><!-- .comment-navigation -->
        <?php endif; // Check for comment navigation ?>
        <?php if ( ! comments_open() && get_comments_number() ) : ?>
        <p class="no-comments"><?php _e( 'Comments are closed.' , 'ivanhoe' ); ?></p>
        <?php endif; ?>
    <?php endif; // have_comments() ?>
    <?php comment_form(); ?>
 </div><!-- #comments -->

标签: phpwordpresswoocommerce

解决方案


在 functions.php 文件中添加此代码

add_theme_support('woocommerce');

推荐阅读