Hi, I'm trying to work out the code to add an increasing number in front of each wordpress post as they are displayed over several pages. I was hoping to show 10 posts per page.
Page 1 show 1 - 10
page 2 shows 11 - 20 and so on
I've got so far. Created a variable which increases in each iteration of The Loop. eg.
<?php $counter = 1; ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
... skipping some code ...
<h1>#<?php echo $counter; ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?> blurb"><?php the_title(); ?></a></h1>
<?php $counter++; ?>
Works fine if I have all the posts on one page but as soon as I split it over two pages the second page starts again with the first post showing 1 - not 11.
I believe WordPress keeps the page number in a variable called $paged, and I think I need to global $paged and add ($paged * num_per_page) to the counter but being a php dunce it's all a bit beyond me.
I'm hoping someone can give me the exact code I need to use. Probably only a two minute job if you know what you're doing.
Hello! I can do it for You for only $30. It will take me no longer than 1-2 hours from now. IF You choose me I will do my best to do it as soon as possible. I can start immidiately. best regards Birdwatcher