【问题标题】:There is a notice in the single-product.php woocommerce, The photo is in the descriptionsingle-product.php woocommerce中有一条通知,图片在描述中
【发布时间】:2018-11-19 21:38:20
【问题描述】:

Notice: Theme without comments.php is deprecated since version 3.0 with no alternative available. Please include a comments.php template in your theme. in /--/--/--/--/wp-includes/functions.php on line 3984.

single-product.php woocommerce 文件中有一个通知 ,我看到了 cmets 的列表但是有这个通知

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

主题中的这个 cmets.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 -->

【问题讨论】:

  • 如错误信息所述:您使用的主题缺少 cmets.php 模板文件。请让主题提供者包含此模板或自行创建 cmets 模板文件。
  • 我自己是这个主题的设计者,我也在我的主题和模板中添加了 cmets.php 文件,但我在 single-product.php woocommerce 文件中有此通知,但我在 single-product.php 中没有此通知- post.php 文件
  • 你能发布你的 cmets.php 文件吗?
  • 您是否在任何插件和主题的任何地方使用此功能comments_template()?签入所有插件
  • woocommerce 3.5.1 和 wordpress 4.9.8,是的,我在 single-post.php 中使用了 cmets_template

标签: php wordpress woocommerce


【解决方案1】:

将此代码添加到functions.php文件中

add_theme_support('woocommerce');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 2020-06-18
    • 2020-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-12
    相关资源
    最近更新 更多