I’ve created a page with a list of posts from a specific category. I would like to enumerate this list like this:
- lecture 1: post title 1
- lecture 2: post title 2
- lecture 3: post title 3
- etc.
How can I do this?
Thanks
I’ve created a page with a list of posts from a specific category. I would like to enumerate this list like this:
How can I do this?
Thanks
You must be logged in to post a comment.
I am not sure what your loop looks like from which you are adding the articles to your list. All you need do is to create a variable to hold your counter somewhere before the while statement in your loop. This could be something like
Note I am setting the counter to 0. Within the while statement you now enumerate this variable, this will keep on adding one to the counter for every time through the loop.
Inside your loop you now use the variable to show the numbers you are interested in. This will give you a one on the first loop, two on the second etc.
Hope this helps.
I adapted my loop to be like the one proposed by RXN, so it is like this:
and I introduced a list-style-type:decimal; in the stylesheed. Nevertheless I got a consecutive list of numbers for each post title everywhere but on Explorer (this give me a list of 1.,1.,1.,etc.) so I’m, at best, half way to success.
Any thoughts? I would like to try whith the
<?php $counter = 0; ?>
but I really don’t know what to do with it.Thanks
Here is what I found in the Codex. Simply replace the category number with the one you are using. I modified it with the counter you requested.
HTH