簡體   English   中英

WordPress的評論部分不顯示

[英]Wordpress Comments Section Not Showing

我不知所措,無法在我的單個帖子頁上顯示我的評論部分的解決方案。 我注意到該頁面在post和tags部分下方未顯示任何代碼。 有人願意為我查看管理員中的代碼嗎? 我想這可能很容易識別,因為網站組織得很好。

這是我認為可以解決問題的唯一方法。

UPDATE UPDATE UPDATE。 這是Single.php

<?php get_header(); ?>

    <?php include ('page_header.php'); ?>
    <?php include ('page_navigation.php'); ?>       


    <div id="page-content" class="clearfix">

        <div id="content-container" class="clearfix">

            <div id="main-content">

                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                    <?php if ( get_option('minimax_post_layout') == 'head-three' ) { ?>

                        <h2><?php the_title(); ?><em>Posted on <?php the_time('D, M d, Y') ?></em></h2>     
                        <?php if ( has_post_thumbnail() ) { ?>
                        <div class="post-item-thumb-<?php echo get_option('minimax_post_layout'); ?>">
                        <?php the_post_thumbnail('thumb_post_3'); ?>
                        </div>
                        <?php } ?>                                                                                                  

                    <?php } else { ?>

                        <?php if ( has_post_thumbnail() ) { ?>
                        <div class="post-item-thumb-<?php echo get_option('minimax_post_layout'); ?>">
                        <?php the_post_thumbnail('thumb_post_2'); ?>
                        </div>
                        <?php } ?>                                                                      
                        <h2><?php the_title(); ?><em>Posted on <?php the_time('D, M d, Y') ?></em></h2>     

                    <?php } ?>                                                              

                    <?php the_content(); ?>

                    <?php edit_post_link('Edit', '<br /><p>', '</p>'); ?>   

                    <?php include ('post_related.php'); ?>

                    <div id="post-indexing"> <?php the_tags('<strong>Tagged as</strong> ',', ','+'); ?><br /><strong>Categorized as</strong> <?php the_category(', ','single'); ?></div>                

                    <?php include ('post_author.php'); ?>   


                    <?php comments_template(); ?>               

                <?php endwhile; else: ?>
                    <p><?php _e('Sorry, no pages matched your criteria.'); ?></p>
                <?php endif; ?>

            </div><!-- end main-content -->

            <?php include ('sidebar_post.php'); ?>  

        </div><!-- end content-container -->


        <?php include ('footer_columns_posts.php'); ?>


    </div><!-- end page-content -->

<?php get_footer(); ?>      

另外,這是comments.php頁面:

<div id="comments">
<?php // Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
        ?>

        <p class="nocomments">This post is password protected. Enter the password to view comments.</p>

        <?php
        return;
    }
}

/* This variable is for alternating comment background */
$oddcomment = 'class="alt" ';
?>

<!-- You can start editing here. -->



<?php if ($comments) : ?>

<h2>Comments <span>(<?php comments_number('No Responses', 'One Response', '% Responses' );?

>)</span></h2>

<ul class="commentlist">
    <?php wp_list_comments('avatar_size=60&type=comment'); ?>
</ul>    

 <?php else : // this is displayed if there are no comments so far ?>

<?php if ('open' == $post->comment_status) : ?>
    <!-- If comments are open, but there are no comments. -->

 <?php else : // comments are closed ?>
    <!-- If comments are closed. -->

<?php endif; ?>
<?php endif; ?>


<?php if ('open' == $post->comment_status) : ?>

<div id="respond">

<h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
<div class="cancel-comment-reply">
<?php cancel_comment_reply_link(); ?>
</div>

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo 
urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
<?php else : ?>


<div id="post-comment" class="clearfix">

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" 
id="commentform">
<fieldset>
<?php if ( $user_ID ) : ?>

<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo
$user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?
action=logout" title="Log out of this account">Log out &raquo;</a></p>

<?php else : ?>


<label for="author"><?php if ($req) echo "* "; ?>Your name:</label>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22"
tabindex="1" />

<label for="email"><?php if ($req) echo "* "; ?>Mail (will not be published):</label>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>"
size="22" tabindex="2" />

<label for="url">Website</label>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22"
tabindex="3" />


<?php endif; ?>

<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?
></code></small></p>-->

<label for="comment" class="comment">Your comment:</label>
<textarea name="comment" id="comment" class="comment" cols="61%" rows="10" 
tabindex="4"></textarea>

<input name="submit" type="submit" class="submit" alt="Submit Comment" id="submit" tabindex="5"
value="Submit Comment" />
<input type="hidden" class="hide" name="comment_post_ID" value="<?php echo $id; ?>" />

<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</fieldset>
</form>
</div><!-- end post-comment -->
</div>
<?php endif; // If registration required and not logged in ?>


<?php endif; // if you delete this the sky will fall on your head ?>
</div>

這是post_author.php

<?php if ( get_option('minimax_author') == 'yes' ) { ?>
<div id="author-desc" class="clearfix">
<?php the_author_image(); ?>
<h4>About the Author</h4>
<?php the_author_description(); ?>
</div>
<?php } ?>

在Wordpress中沒有像the_author_image()這樣的函數。 因此,您必須刪除

<?php the_author_image(); ?>

從您的post_author.php 如果要顯示作者圖像,請從Gravatar獲取Wordpress的化身。 您可以使用get_avatar()顯示作者的Gravatar。

echo get_avatar(get_the_author_id());

簡而言之 ,請使用以下命令:

<?php echo get_avatar(get_the_author_id()); ?>

代替這個:

<?php the_author_image(); ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM