Title: Zero padding numeric comment numbers
Last modified: August 19, 2016

---

# Zero padding numeric comment numbers

 *  [vlogtheimpaler](https://wordpress.org/support/users/vlogtheimpaler/)
 * (@vlogtheimpaler)
 * [18 years ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/)
 * I’ve searched and searched and am wondering if something like the following exists
   for tweaking the display on comment “numbers”. I’d just like to display the comments
   completely numerically but zero pad the output to a fixed position. So when there
   are 7, 21, or 100 comments it would instead display it as 0007, 0021, 0100 respectively.
 * Anyone know of a good plugin or method to help me along in my quest?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Clicknathan](https://wordpress.org/support/users/clicknathan/)
 * (@clicknathan)
 * [18 years ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756616)
 * You should be able to use CSS to do that. Find the `<ol>` wrapper in your comments.
   php template and change it to `<ol style="list-style-type:decimal-leading-zero;"
   >`
 * See how that works out for you.
 *  Thread Starter [vlogtheimpaler](https://wordpress.org/support/users/vlogtheimpaler/)
 * (@vlogtheimpaler)
 * [18 years ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756630)
 * I’m actually using list-style-type: none; to to drop numerals and bullet points
   across the board. In addition I’d like to be able to pull data before and after
   without having to resort to further CSS headaches while styling the padded zero
   portion different from the actual number. First I’d just like to get those leading
   zeros in there via PHP with a plugin if at all possible.
 *  Thread Starter [vlogtheimpaler](https://wordpress.org/support/users/vlogtheimpaler/)
 * (@vlogtheimpaler)
 * [18 years ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756674)
 * Ideas anyone? Nathan?
 *  [jthomasc](https://wordpress.org/support/users/jthomasc/)
 * (@jthomasc)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756746)
 * Vlog,
    I stumbled upon this post while trying to find the same solution. Not 
   sure if you found your answer but I was able to come up with a solution that 
   worked for me. I was looking to pad the comment number, so that it was always
   3 digits, in a link that was being generated by the function
 * `comments_popup_link('000', '001', '%');`
 * What I did was rather than use this function I dissected how it was getting all
   it’s bits and replaced the instance of the function call with the following code.
 *     ```
       echo '<a href="'.get_permalink().'#comments" title="Comment on '.get_the_title().'">';
       printf ("%03d", get_comments_number());
       echo '</a>';
       ```
   
 * It’s not exactly the most elegant thing but it does what I want it to. Hope that’s
   helpful.
 * J.
 *  [createsean](https://wordpress.org/support/users/createsean/)
 * (@createsean)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756794)
 * jthomasc – this worked perfectly.
 * thank you.
 *  [createsean](https://wordpress.org/support/users/createsean/)
 * (@createsean)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756795)
 * jthomasc,
 * one problem – this code doesn’t give you the option to do something like this:
 * `comments_popup_link('add', '1', '%');`
 * While where the % gets the leading zeros but ‘add’ is still an option for no 
   comments. Any way to accomplish this?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Zero padding numeric comment numbers’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [modified](https://wordpress.org/support/topic-tag/modified/)

 * 6 replies
 * 4 participants
 * Last reply from: [createsean](https://wordpress.org/support/users/createsean/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/zero-padding-numeric-comment-numbers/#post-756795)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
