Forums › Forums › Search & Filter Pro › Pagination not working on custom query
Tagged: Pagination Ajax
- This topic has 1 reply, 2 voices, and was last updated 5 years, 3 months ago by Trevor.
-
Anonymous(Private) August 1, 2019 at 10:05 am #217756
Hi,
The pagination on my query is not showing at all:
<?php $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; ?>
<?php $loop = array(
‘post_type’ => ‘post’,
‘pagination’ => $paged,
‘posts_per_page’ => 8,
‘order’ => ‘DATE’,
‘ignore_sticky_posts’ => 2,);
$loop[‘search_filter_id’] = 107;
?>
<?php $query_a = new WP_Query($loop); ?>
<?php if ($query_a->have_posts()) : ?>
<div id=”nieuws” class=”container”>
<div class=”row”>
<?php while ($query_a->have_posts()) : $query_a->the_post(); ?>
<div class=”col-lg-3 col-md-6 col-sm-12″>
<div class=”card”>
“>
<div class=”card-thumb” style=”background-image: url(<?php the_post_thumbnail_url(); ?>);”>
<?php
$terms = get_the_terms($post->ID, array(‘doelgroep’));
$i = 1;
if ($terms) { ?>
<div class=”terms”>
<?php
foreach ($terms as $term) {
$term_link = get_term_link($term, array(‘doelgroep’));
if (is_wp_error($term_link))
continue;
echo $term->name;
echo ($i < count($terms)) ? “, ” : “”;
$i++;
} ?>
</div>
<?php } ?>
</div>
<div class=”card-info”>
<h3><?php the_title(); ?></h3>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<div id=”sf-pagination”>
<?php
echo paginate_links( array(
‘total’ => $query_a->max_num_pages,
‘current’ => max( 1, get_query_var( ‘paged’ ) ),
‘format’ => ‘?paged=%#%’,
‘show_all’ => false,
‘type’ => ‘plain’,
‘end_size’ => 2,
‘mid_size’ => 1,
‘prev_next’ => true,
‘prev_text’ => sprintf( ‘<i></i> %1$s’, __( ‘Newer Posts’, ‘text-domain’ ) ),
‘next_text’ => sprintf( ‘%1$s <i></i>’, __( ‘Older Posts’, ‘text-domain’ ) ),
‘add_args’ => false,
‘add_fragment’ => ”,
) );
?>
</div>
</div>
<?php wp_reset_postdata($query_a); ?>
<?php endif; ?>What is it I am doing wrong?
Console tells me this:
search-filter-build.min.js?ver=2.4.6:2 Uncaught TypeError: Cannot read property ‘split’ of undefined
at HTMLFormElement.getQueryParamFromURL (search-filter-build.min.js?ver=2.4.6:2)
at HTMLFormElement.getPagedFromURL (search-filter-build.min.js?ver=2.4.6:2)
at HTMLDivElement.<anonymous> (search-filter-build.min.js?ver=2.4.6:2)
at HTMLDocument.dispatch (jquery.min.js:3)
at HTMLDocument.r.handle (jquery.min.js:3)On this URL:
http://fietsenwerkt.convident.site/nieuws/
I have AJAX turned on.
Thanks in advance
-
AuthorPosts