max_num_pages > 1 ) { ?>
have_posts()): ob_start(); $archive_style = $_POST['template']; set_query_var( 'archive_style', $archive_style ); // Load a different template for search page else load archive template $template_part = ( isset($query_vars['s']) && !empty($query_vars['s']) )? 'search' : 'archive'; while($posts->have_posts()):$posts->the_post(); get_template_part('template-parts/content', $template_part); endwhile;wp_reset_postdata(); $output['content'][] = ob_get_clean(); wp_send_json_success($output); else: $error = new WP_Error( '500', __('No More Posts','ajima') ); wp_send_json_error( $error ); endif; wp_die(); } endif; add_action( 'wp_ajax_ajima_load_posts', 'ajima_load_posts' ); add_action( 'wp_ajax_nopriv_ajima_load_posts', 'ajima_load_posts' );