wp_page_nav not working on front page with custom post type- solution

If you use wp_page_nav on your wordpress and make a custom post type page as your home page, then the pagination won’t work. You should add this codes underneath where you used wp_page_nave

** jQuerr selector depend on your used selector.

jQuery('.wp-pagenavi a').each(function() {
var url = jQuery( this ).attr('href');
var array = url.split('/');
var lastsegment = array[array.length-2];
jQuery( this ).attr('href', '<?php echo site_url(); ?>?paged='+lastsegment);