max_num_pages; if (!$pages) { $pages = 1; } } if (1 != $pages) { echo "
"; echo "\n"; } } /** * Blog Page Pagination * Ajax Pagination * Load More & Infinite scrolling Paginetion * */ add_action('wp_ajax_nopriv_more_post_ajax', 'more_post_ajax'); // load more add_action('wp_ajax_more_post_ajax', 'more_post_ajax'); add_action('wp_ajax_infinite_scroll', 'infinite_post_ajax'); // scroll add_action('wp_ajax_nopriv_infinite_scroll', 'infinite_post_ajax'); function more_post_ajax(){ scrollPostCalling($_POST,'load_more'); } function infinite_post_ajax(){ scrollPostCalling($_POST,'infinite'); } function scrollPostCalling($post,$scroll){ $paged = $_POST["paged"]; header("Content-Type: text/html"); $args = array( 'post_type' => 'post', 'paged' => $paged, ); $loop = new WP_Query($args); global $grid_layout; if($grid_layout == 'standard-layout'): // Start the post formate loop. while ($loop->have_posts()) : $loop->the_post(); get_template_part( 'content', get_post_format() ); endwhile; else : // Start the post formate grid. while ($loop->have_posts()) : $loop->the_post(); get_template_part( 'content', 'grid'); endwhile; endif; // If no content, include the "No posts found" template. exit; } // load more ajax function th_load_more_ajax(){ global $wp_query; echo "
"; ?>