Forums › Forums › Search & Filter Pro › Problem with pagination
- This topic has 10 replies, 2 voices, and was last updated 7 years, 6 months ago by
Trevor.
-
Anonymous(Private) September 6, 2017 at 8:44 am #129359
I don’t know why but pagination always shows 1 of X. Even though it loads another page content, the url changes and still – it shows 1 of X and the “1” is selected.
Can anyone help please?
The url is: http://newpage.lobohr.pl/
Anonymous(Private) September 6, 2017 at 8:15 pm #129598Thanks for your reply Trevor. Can you help me, because now after choosing a page whole section disappears?
results.php code as follows:
<?php if ( $query->have_posts() ) { ?> <table width="100%" border="0" cellpadding="10"> <tbody> <tr class="naglowki-tabeli"> <th scope="col">DATA PUBLIKACJI</th> <th scope="col"><strong>STANOWISKO</strong></th> <th scope="col">LOKALIZACJA</th> <th scope="col">WYNAGRODZENIE BRUTTO</th> <th scope="col"> </th> </tr> <?php while ($query->have_posts()) { $query->the_post(); ?> <tr class="pojedynczy-wynik-tabeli"> <td><?php echo (new \DateTime($query->post->post_date))->format('Y-m-d'); ?></td> <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td> <td><?php echo get_post_meta($query->post->ID,"lokalizacja",true); ?></td> <td><?php echo get_post_meta($query->post->ID,"wynagrodzenie_brutto",true); ?></td> <td><a href="<?php the_permalink(); ?>">ZOBACZ</a></td> </tr> <?php } ?> </tbody> </table> <div class="pagination"><?php wp_pagenavi(); ?></div> <?php } else { echo "No Results Found"; } ?>
Trevor(Private) September 7, 2017 at 7:42 am #129677For the pagination code, look in our plugin folder, find the templates folder, in that open the results.php in an editor and you will see a good example of how to do it. If that is what you di, my apologies. Don’t forget that it needs to access the query, to be able to count the results.
Trevor(Private) September 8, 2017 at 7:51 am #129921You have this:
<div class="pagination"><?php wp_pagenavi(); ?></div>
But our template shows this:
<div class="pagination"> <?php if (function_exists('wp_pagenavi')) { wp_pagenavi( array( 'query' => $query ) ); } ?> </div>
Is there a reason why you did not use that?
Anonymous(Private) September 11, 2017 at 12:33 pm #130361Thank you Trevor! That was the issue and now it works great on the homepage.
Last thing – I used the same code on a different page and when I click on a pagination i.e. “2” the whole page reloads and jumps to the top, do you know why?
Even when I duplicated the code I got the same issue. -
AuthorPosts