首页 文章

最后一篇文章的评论徽章显示在最后一篇文章

提问于
浏览
0

我有我的第一个定制的WordPress网站(总newb,甚至不会说谎)和运行良好,除了这一个恼人的问题和谷歌搜索没有帮助 . 以下是问题所在的链接:http://tvmopperator.com/blog/

我的自定义帖子评论徽章在博客文章的content-page.php上显示正常,直到我发布更多内容,然后只有第一篇文章的徽章显示 on the last post . 是的,第一篇文章的评论徽章显示在最新帖子上,其中包含正确的评论计数和第一篇帖子的链接,但是_1112245已经花了一整天时间,所以这将是我的第一个stackoverflow问题 .

这是评论徽章代码:

<div class="post-comments-badge">
     <a href="<?php comments_link(); ?>"><i class="fa fa-comments"></i> <?php comments_number( 0, 1, '%' ); ?></a>
</div><!-- post-comments-badge -->

这与我在个人摘录帖子的“content.php”文件中完全相同,这可能是问题......但这就是我的导师所做的 .

我正在学习Udemy课程:https://www.udemy.com/bootstrap-to-wordpress/learn/v4/content

希望对此事有任何帮助 .

1 回答

  • 0

    它只显示一个评论徽章的原因是因为你的 post-comments-badge 类具有绝对位置样式,使其固定在一个位置,因此所有评论标记都会相互重叠 .

    这是代码中有问题的部分:

    .post-comments-badge 
    {
    height: 70px;
    width: 70px;
    position: absolute;
    top: 25px;
    right: 20px;
    border: none;
    -webkit-border-radius: 100%;
    -moz-border-radius: 100%;
    border-radius: 100%;
    background: #4c213d;
    text-align: center;
    display: table;
    }
    

    去掉

    position: absolute;  
    top: 25px;
    right: 20px;
    

    结果代码:

    .post-comments-badge 
    {
    height: 70px;
    width: 70px;
    float: right;
    clear: right;
    border: none;
    -webkit-border-radius: 100%;
    -moz-border-radius: 100%;
    border-radius: 100%;
    background: #4c213d;
    text-align: center;
    display: table;
    }
    

相关问题