Forums › Forums › Search & Filter Pro › Pagination not working
Tagged: pagination vc visual composer
- This topic has 64 replies, 3 voices, and was last updated 7 years, 4 months ago by Ross.
-
Ross Moderator(Private) April 1, 2017 at 7:47 pm #100877
Hi Pierre
Ok couple of things.
1) Redownload the S&F VC (not pro) plugin above (I updated it, same name, same zip so download again and re-install)
2) Add this to functions.php of your theme:
add_filter( 'search_filter_vc_pagination', 'search_filter_vc_pagination' ); function search_filter_vc_pagination() { global $wp_query; $big = 999999999; // need an unlikely integer $translated = __( 'Page', 'mytextdomain' ); // Supply translatable string $output = 'Custom Pagination: '; $output .= paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'before_page_number' => '<span class="screen-reader-text">'.$translated.' </span>' ) ); return $output; }
—-
Now when you check the pagination, I’m sure it won’t look how you want, but you will see the message “Custom Pagination”?
What I’ve done is added another way to customise pagination, by adding this code to functions.php, you can literally use any WP functions to create your pagination – basically you get full control.
The code I added above is just one example of how you can add in your own pagination, in this example I am using the WP function
paginate_links
.If you do not add the above code to functions.php, then the pagination will work as it currently does (from your screenshot) and is generated by another WP pagination function
get_the_posts_pagination
– both can look pretty much the same – I’m just demonstrating flexibility by using another WP function to do the job.—-
You mention customisation / integration with your theme.
Unfortunately thats out of remit of our support here – what you are looking for is how to make the WP functions
paginate_links
orget_the_posts_pagination
, work and look nice with your theme.This is something you should talk to your theme devs/support about. They will likely have a snippet of code (probably already used in some other template files) that you could literally copy and paste.
If you manage to get hold of the correct code to use to integrate the WP functions with your theme and use the correct styles, but you are still stuck, I can advise on how to integrate that with our code above just let me know.
Hope that helps!
Best
-
AuthorPosts