insight on $post_num
-
i’m having trouble finding information on $post_num
what it is and what it does and what you can do with it.
I’m using it like this:
<?php $my_query = new WP_Query('category_name=localexperts&posts_per_page=-1&meta_key=le_region&meta_value=Asia'); ?> <table class="le_table"> <?php while ($my_query->have_posts()) : $my_query->the_post(); update_post_caches($posts); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php if ( ++$post_num % 2 ) { ?> <tr> <td class="le_tableleft"> <div class="localexp"><?php echo gi_thumb(1); ?> <span class="posttitle"><?php the_title(); ?></span><?php the_excerpt(); ?><br class="clear" /><?php the_content(); ?> </div> </td> <?php } else { ?> <td class="le_tableright"> <div class="localexp"><?php echo gi_thumb(1); ?> <span class="posttitle"><?php the_title(); ?></span><?php the_excerpt(); ?><br class="clear" /><?php the_content(); ?> </div> </td> </tr> <?php } ?>
Building a table dynamically, every two posts creating a table row (so that they will be the same height, the longest entry setting the height)
problem is, i have multiple loops on this page all doing that
i need the post_num to “reset” at each loop
if it ends on an odd post, the first post in the next loop should be odd as well (‘1’), but now thats not the case
anyone use $post_num much?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘insight on $post_num’ is closed to new replies.