• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2671

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Tutorial Requests
  • Contact
  • Videos
  • Tags
  • Log in

Premium Member? - Request custom code

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

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Brad Dalton Specializes In Genesis child theme customization & code modification. Read More…

Learn PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems