Forums › Forums › Search & Filter Pro › the_posts_pagination
Tagged: post navigation
- This topic has 12 replies, 2 voices, and was last updated 4 years, 4 months ago by Trevor.
-
Anonymous(Private) June 12, 2020 at 9:04 am #248563
I’ve set up an archive page. Filtering goes well. I set the results for the page to 5 in the settings of the plugin, but I can’t seem to get the post navigation working. I have more than 5 posts, but no post navigation so far. Adding or deleting ‘posts_per_page’ in my args doesn’t effect it. Any thoughts how to fix this?
Anonymous(Private) June 18, 2020 at 3:02 pm #249357Hi Trevor,
Url: https://gofreelancer.nl/freelancers and https://gofreelancer.nl/opdrachten/
Used Ajax container: .post-inhoud
Pagination selector: .nav-links a
Results per page: 5I used the same code for the pagination on https://gofreelancer.nl/veelgestelde-vragen/
Not using the filter plugin there, so you can see the pagination code and links working there.Trevor(Private) June 18, 2020 at 4:59 pm #249371Hi Johan
I can see that you are using Elementor Pro, but the grid does not appear to be their Posts widget? Is that correct? Is it made with a widget from another plugin?
The form is set to ‘Custom’ display results method, but how did you link that to the grid?
Anonymous(Private) June 18, 2020 at 5:14 pm #249375Its hand coded. No plugin.
I added the search_filter-id to the WP_Query ($args).$currentPage = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'freelancer', 'search_filter_id'=> 73, 'posts_per_page' => 3, 'paged'=>$currentPage ); $query = new WP_Query($args);
And added the shortcode in the left-column:
<?php echo do_shortcode('[searchandfilter id="73"]' );?>
Anonymous(Private) June 18, 2020 at 6:20 pm #249382<?php /** * Template name: Freelancers page * * @package Freelancer */ get_header(); ?> <?php echo do_shortcode( '[elementor-template id="499"]');?> <section class="container-flex"> <div class="left-column"> <h3>Categorieën</h3> <?php echo do_shortcode('[searchandfilter id="73"]' );?> </div> <div class="right-column"> <div class="header-right-column"> <h1><i class="fa fa-handshake-o" aria-hidden="true"></i>Freelancers - Ready To Work</h1> </div> <?php $currentPage = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'freelancer', 'search_filter_id'=> 73, 'posts_per_page' => 3, 'paged'=>$currentPage ); $query = new WP_Query($args); if($query->have_posts()): ?> <?php while ($query->have_posts()) : $query->the_post(); ?> <div class="post-inhoud"> <div class="flex-box"> <div class="box-left"> <?php if( get_field('profielfoto') ): ?> <img />" /> <?php endif; ?> </div> <div class="box-right"> <h3><?php the_title(); ?></h3> <h4 class=""><?php the_field('functie'); ?></h4> </div> </div><!-- end of .flex-box--> <?php the_category(); ?> <p class="meta"><i class="fa fa-map-marker" aria-hidden="true"></i><?php the_field('locatie_freelancer'); ?> <i class="fa fa-money" aria-hidden="true"></i>€ <?php the_field('uurprijs'); ?>,- per uur <i class="fa fa-calendar-o" aria-hidden="true"></i>Beschikbaar per week: <?php the_field('beschikbaarheid'); ?> uur</p> <p><?php $summary = get_field('omschrijving_vaardigheden'); echo substr($summary, 0, 150); ?><a>"> ....lees verder.. </a></p><br> <a>"><button type="button">Naar profiel <i class="fa fa-chevron-right" aria-hidden="true"></i></button></a> </div><!--end of .post-inhoud--> <?php endwhile; ?> <?php else : echo "<p class='geen-zoekresultaat'>Er zijn geen zoekresultaten!</p><br>"; ?> <?php $GLOBALS['wp_query']->max_num_pages = $query->max_num_pages; the_posts_pagination( array( 'mid_size' => 3, 'prev_text' => __( 'Vorige pagina', 'freelancer' ), 'next_text' => __( 'Volgende pagina', 'freelancer' ), 'screen_reader_text' => __( 'Posts navigation', 'freelancer' ) ) ); ?> <?php endif; ?> <?php wp_reset_postdata(); ?> </div><!--end of .right-column--> </section> <?php get_sidebar(); get_footer();
-
AuthorPosts