max_num_pages > 1 ) { ?>
have_posts() ) : ob_start(); $archive_style = $_POST['template']; set_query_var( 'archive_style', $archive_style ); // Set a query var for new query to work with the default query. set_query_var( 'archive_query', $posts ); // Load a different template for search page else load archive template. if ( $is_search ) { $template_part = 'template-parts/content/content-search'; } else { $template_part = 'template-parts/archive/styles/' . $archive_style; } get_template_part( $template_part ); $output['content'][] = ob_get_clean(); wp_send_json_success( $output ); else : $error = new WP_Error( '500', __( 'No More Posts', 'blogmarks' ) ); wp_send_json_error( $error ); endif; wp_die(); } endif; add_action( 'wp_ajax_blogmarks_load_posts', 'blogmarks_load_posts' ); add_action( 'wp_ajax_nopriv_blogmarks_load_posts', 'blogmarks_load_posts' );