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.

  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]);
            console.log(trail)
            var num = 0;
            jQ('.post-body-wrapper').each(function () {
               num++;
               jQ(this).find('.post-edit').append('#'+num);
               if (num == 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.