Forums Forums Search & Filter Pro the_posts_pagination

Viewing 10 posts - 1 through 10 (of 13 total)
  • Anonymous
    #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?

    Trevor
    #248604

    Are you saying that the pagination section is missing?

    Are you able to send me a live link/URL to your search page so I can take a look?

    Anonymous
    #248648

    Yes, the pagination is missing…
    Site is om Mamp. But i will get back here when it’s on the actual domain.

    Trevor
    #248783

    Hi Johan

    I will leave this thread open and wait for you to get back to me when that is ready.

    Anonymous
    #249357

    Hi Trevor,

    Url: https://gofreelancer.nl/freelancers and https://gofreelancer.nl/opdrachten/

    Used Ajax container: .post-inhoud
    Pagination selector: .nav-links a
    Results per page: 5

    I 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.

    Anonymous
    #249359

    Correction:
    Used Ajax container: .right-column

    Trevor
    #249371

    Hi 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
    #249375

    Its 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"]' );?>

    Trevor
    #249379

    Are you able to show me that template file (you could upload it to a file sharing site)?

    Please note that we are now closed for the day as it is late afternoon here in the UK, so my next reply may not be until tomorrow.

    Anonymous
    #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'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-money" aria-hidden="true"></i>€ <?php the_field('uurprijs'); ?>,- per uur&nbsp;&nbsp;&nbsp;&nbsp;
    				<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();
Viewing 10 posts - 1 through 10 (of 13 total)