Pagination in custom query problem
-
Hi everyone!
Got a php page, that make a post query$page = (get_query_var('paged')) ? get_query_var('paged') : 1; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query -> query('cat=4&showposts=3'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?>Below on this page, i am trying to make navigation.
<ul class="pagination__nav"> <li class="pagination__item pagination__item--active"><a href="#" class="pagination__link">1</a></li> <li class="pagination__item"><a href="#" class="pagination__link">2</a></li> <li class="pagination__item"><a href="#" class="pagination__link">3</a></li> <li class="pagination__item"><a href="#" class="pagination__link">4</a></li> <li class="pagination__item"><a href="#" class="pagination__link">5</a></li> <li class="pagination__item"><a href="#" class="pagination__link">6</a></li> <li class="pagination__item"><a href="#" class="pagination__link">7</a></li> </ul> <a href="<?php echo get_previous_posts_page_link(); ?>" class="pagination__control pagination__control--prev"> <svg> <use xlink:href="#pagination-conrol-prev"></use> </svg> </a> <a href="<?php echo get_next_posts_page_link(); ?>" class="pagination__control pagination__control--next"> <svg> <use xlink:href="#pagination-conrol-next"></use> </svg> </a>The arrows are working normally, but i am really not sure how to make the page numbers to generate.
And if possible – can someone please also tell me how to make the active page number get another css class?
Many thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Pagination in custom query problem’ is closed to new replies.