Automatic Numbering for Headings (1, 1.1, 1.2...)
Numbers the H2 and H3 headings inside any block with the class "wpide-numbered-headings" (1., 1.1, 1.2, 2.), ideal for guides, documentation and terms pages.
Opens WPIDE on
Code
.wpide-numbered-headings {
counter-reset: wpide-h2;
}
.wpide-numbered-headings h2 {
counter-increment: wpide-h2;
counter-reset: wpide-h3;
}
.wpide-numbered-headings h2::before {
content: counter(wpide-h2) ". ";
opacity: 0.6;
}
.wpide-numbered-headings h3 {
counter-increment: wpide-h3;
}
.wpide-numbered-headings h3::before {
content: counter(wpide-h2) "." counter(wpide-h3) " ";
opacity: 0.6;
}
Notes
Add wpide-numbered-headings to the Post Content block (block themes) or to a Group that wraps your text.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.