Pagination with WP_Query()
-
Hi everyone (sorry i f my english is bad but i’m a french guy ?? )
So my problem is the next:I bought a template 2weeks ago. The code below:
<div id="column-setup"><!-- Begin Column Setup --> <div class="column-left"><!-- Begin Post One Block --> <?php $my_query = new WP_Query('showposts=1&offset=0'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post One Block --> <div class="column-middle"><!-- Begin Post Two Block --> <?php $my_query = new WP_Query('showposts=1&offset=1'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Two Block --> <div class="column-right"><!-- Begin Post Three Block --> <?php $my_query = new WP_Query('showposts=1&offset=2'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Three Block --> <div style="clear: both;border-bottom: 1px solid #e9e9e9;"></div> <div class="column-left"><!-- Begin Post Four Block --> <?php $my_query = new WP_Query('showposts=1&offset=3'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Four Block --> <div class="column-middle"><!-- Begin Post Five Block --> <?php $my_query = new WP_Query('showposts=1&offset=4'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Five Block --> <div class="column-right"><!-- Begin Post Six Block --> <?php $my_query = new WP_Query('showposts=1&offset=5'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Six Block --> <div style="clear: both;border-bottom: 1px solid #e9e9e9;"></div> <div class="column-left"><!-- Begin Post Seven Block --> <?php $my_query = new WP_Query('showposts=1&offset=6'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Seven Block --> <div class="column-middle"><!-- Begin Post Eight Block --> <?php $my_query = new WP_Query('showposts=1&offset=7'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Eight Block --> <div class="column-right"><!-- Begin Post Nine Block --> <?php $my_query = new WP_Query('showposts=1&offset=8'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <h1 class="block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <h5 class="postinfo"><?php the_time('F j, Y'); ?> // Par <?php the_author(); ?></h5> <a href="<?php the_permalink(); ?>"><img src="<?php viva(70,'');?>" alt="<?php the_title(); ?> <?php _e('thumbnail'); ?>" align="left" style="border: 1px solid #b4b4b4; padding: 1px; margin: 2px 20px 0px 0px; width: 70px; height: 70px;"/></a> <?php wswwpx_content_extract ( ' ', 18, 18 ); ?><br /><br /> <p align="right"><a href="<?php the_permalink(); ?>">Lire la suite</a></p> <?php endwhile; ?> </div><!-- End Post Nine Block --> </div><!-- End Column Setup -->
It is a square presentation: 3 with 3 line items.
The problem is that I have no paging my pages so I can see that the last 9 items.How do I make a pagination with wp_query ()?
I see a lot of post with paged but i don’t understand how i must integrate the code.
Can you help me ?
Thank you in advance for your help
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Pagination with WP_Query()’ is closed to new replies.