Help > Forum > 主题和帖子 > 在每个帖子旁边显示帖子编号

在每个帖子旁边显示帖子编号

中的帖子 新主题 目前没有可用于在讨论中引用他们的帖子号或 ID。我们很快将添加一项功能,可以轻松地按编号引用新主题中的帖子。同时,您可以按照以下说明在主题中的每篇文章旁边添加帖子编号。

请注意,要引用新主题中的特定帖子,使用引用按钮是理想的选择。报价将包含指向该帖子的链接,以便用户可以轻松地跳转到该特定帖子。这比使用帖子编号更可取,因为如果以后出于任何原因删除帖子,讨论中提到的帖子编号将不正确。每篇文章还包含一个分享链接,你可以用它来获取该特定帖子的链接。

  1. 登录您的Website Toolbox账户。
  2. 点击 整合 主菜单中的链接。
  3. 点击 HTML 链接。
  4. 将下面的 HTML 代码复制到 论坛头标记 HTML 代码 文本框:

    <!-- Add post numbers next to each post of a topic. ie: #1, #2, #3 -->
    <script>
    window.addEventListener("DOMContentLoaded", function() {
        if (jQ('#posts-list').length && window.location.href.match(/\/post\//)) {
            if (jQ('.page-numbers').length) {
                var matches = jQ('.page-numbers').text().replace(',','').match(/[0-9]+/);
                if (matches) {
                    var trail = parseInt(matches[0]);
                    var num = 0;
                    jQ('.post-body.pull-left').each(function () {
                        if(jQ(this).find('.post-edit').length) {
                            num++;
                            jQ(this).find('.post-edit').eq(0).before("#"+num+"");
                        }
                        if (num == 1 && trail > 1) {
                            num = trail - 1;
                        }
                    });
                }
            } else {
                var num = 0;
                jQ('.post-body.pull-left').each(function () {
                    num++;
                    jQ(this).find('.post-edit').eq(0).before("#"+num+"");
                });
            }
        }
    });
    </script>
    
    <style>
      [id^="post_list_"] .panel-dropdown {
        display: flex;
        align-items: center;
      }
    </style>
    
  5. 保存 这些变化。


If you still need help, please contact us.