Auto Increment Numbers Before List Items Using The counter-increment CSS Property

This CSS automatically adds numbers before each list item using the most recent posts widget native to all WordPress installations.

This solution helps when you don’t have access to the HTML or PHP code which generates the HTML.

Here’s the CSS you can simply copy & paste into your child themes style sheet and clear caching especially if using Chrome.

.sidebar-primary .widget_recent_entries li {
    list-style-type: none;
    counter-increment: auto-increment-numbers;
    display: flex;
}

.sidebar-primary .widget_recent_entries li::before  {
    content: counter(auto-increment-numbers);
    margin-right: 20px;
    font-size: 36px;
    color: #CCC;
    line-height: 36px;
}

Tested using the Genesis Sample child theme by StudioPress.

Uses CSS counters

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.