Help > Forum > Topics & Posts > Showing a post number next to each post

Showing a post number next to each post

Posts in the new themes don't currently have a post number or ID which can be used to reference them in discussions. We'll soon be adding a feature which makes it easy to reference posts in new themes by number. In the meantime, you can follow the instructions below to add a post number next to each post in a topic.

Note that for referencing a specific post in the new themes, using the quote button is ideal. The quote will include a link to the post so that the user can easily jump to that specific post. This is preferred over using a post number because post numbers mentioned in the discussion will be incorrect if a post is deleted later on for any reason. Each post also includes a Share link, which you can use to get a link for that specific post.

  1. Log in to your Website Toolbox account.
  2. Click the Appearance link.
  3. In the Appearance menu, click the HTML link.
  4. Copy the HTML code below into the Forum Head Tag HTML Code text box:

    <!-- Add post numbers next to each post of a topic. ie: #1, #2, #3 -->
    <script>
    window.addEventListener("load", function() {
        if (jQ('#posts-list').length && window.location.href.match(/\/post\//)) {
            if (jQ('.page-numbers').length) {
                var matches = jQ('.page-numbers').text().match(/[0-9]+/);
                if (matches) {
                    var trail = parseInt(matches[0]);
                    var num = 0;
                    jQ('.post-body-wrapper').each(function () {                    
                        if(jQ(this).find('.post-edit').length) {
                            num++;
                            jQ(this).find('.post-edit').append('#'+num);
                        }
                        if (num == 1 && trail > 1) {
                            num = trail - 1;
                        }
                    });
                }
            } else {
                var num = 0;
                jQ('.post-body-wrapper').each(function () {
    
                num++;
                jQ(this).find('.post-edit').append('#'+num);
                });
            }
        }
    });
    </script>
    
  5. Save the changes.


If you still need help, please contact us.