WP_Query Object ( [query] => Array ( [page] => [pagename] => events ) [query_vars] => Array ( [page] => 0 [pagename] => events [error] => [m] => [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => events [static] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author] => [author_name] => [feed] => [tb] => [paged] => 0 [meta_key] => [meta_value] => [preview] => [s] => [sentence] => [title] => [fields] => [menu_order] => [embed] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [post_name__in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [post_parent__in] => Array ( ) [post_parent__not_in] => Array ( ) [author__in] => Array ( ) [author__not_in] => Array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [lazy_load_term_meta] => 1 [update_post_meta_cache] => 1 [post_type] => [posts_per_page] => 10 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [order] => DESC ) [tax_query] => [meta_query] => WP_Meta_Query Object ( [queries] => Array ( ) [relation] => [meta_table] => [meta_id_column] => [primary_table] => [primary_id_column] => [table_aliases:protected] => Array ( ) [clauses:protected] => Array ( ) [has_or_relation:protected] => ) [date_query] => [queried_object] => WP_Post Object ( [ID] => 181 [post_author] => 1 [post_date] => 2016-06-26 22:05:23 [post_date_gmt] => 2016-06-26 21:05:23 [post_content] => [post_title] => Past Events [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => events [to_ping] => [pinged] => [post_modified] => 2018-12-28 00:37:56 [post_modified_gmt] => 2018-12-28 00:37:56 [post_content_filtered] => [post_parent] => 0 [guid] => http://hexagon-society.com/?page_id=181 [menu_order] => 0 [post_type] => page [post_mime_type] => [comment_count] => 0 [filter] => raw ) [queried_object_id] => 181 [request] => SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '181') AND wp_posts.post_type = 'page' ORDER BY wp_posts.post_date DESC [posts] => Array ( [0] => WP_Post Object ( [ID] => 181 [post_author] => 1 [post_date] => 2016-06-26 22:05:23 [post_date_gmt] => 2016-06-26 21:05:23 [post_content] => [post_title] => Past Events [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => events [to_ping] => [pinged] => [post_modified] => 2018-12-28 00:37:56 [post_modified_gmt] => 2018-12-28 00:37:56 [post_content_filtered] => [post_parent] => 0 [guid] => http://hexagon-society.com/?page_id=181 [menu_order] => 0 [post_type] => page [post_mime_type] => [comment_count] => 0 [filter] => raw ) ) [post_count] => 1 [current_post] => -1 [in_the_loop] => [post] => WP_Post Object ( [ID] => 181 [post_author] => 1 [post_date] => 2016-06-26 22:05:23 [post_date_gmt] => 2016-06-26 21:05:23 [post_content] => [post_title] => Past Events [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => events [to_ping] => [pinged] => [post_modified] => 2018-12-28 00:37:56 [post_modified_gmt] => 2018-12-28 00:37:56 [post_content_filtered] => [post_parent] => 0 [guid] => http://hexagon-society.com/?page_id=181 [menu_order] => 0 [post_type] => page [post_mime_type] => [comment_count] => 0 [filter] => raw ) [comment_count] => 0 [current_comment] => -1 [found_posts] => 1 [max_num_pages] => 0 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => 1 [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => [is_404] => [is_embed] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => 1 [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash:WP_Query:private] => ea93389b52601b05e717ff2d94be3307 [query_vars_changed:WP_Query:private] => [thumbnails_cached] => [stopwords:WP_Query:private] => [compat_fields:WP_Query:private] => Array ( [0] => query_vars_hash [1] => query_vars_changed ) [compat_methods:WP_Query:private] => Array ( [0] => init_query_flags [1] => parse_tax_query ) )
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
function true_load_posts(){
$args = unserialize( stripslashes( $_POST['query'] ) );
$args['paged'] = $_POST['page'] + 1; // следующая страница
$args['post_status'] = 'publish';
$args['post_type'] = 'event';
// обычно лучше использовать WP_Query, но не здесь
query_posts( $args );
// если посты есть
$custom_query = new WP_Query( array( 'post_type' => 'event'));
if ($custom_query->have_posts()) : while ($custom_query->have_posts()) : $custom_query->the_post();?>
<div class="top-event-block">
<div class="upcoming-data"><?php echo get_the_date("M j, Y");?></div>
<div class="upcoming-title"><?php the_title(); ?></div>
<div class="upcoming-exp"><?php the_excerpt();?></div>
<div class="upcoming-read-more"><a href="<?php echo the_permalink(); ?>">Read more</a></div>
</div>
<?php
endwhile;
endif;
die();
}
add_action('wp_ajax_loadmore', 'true_load_posts');
add_action('wp_ajax_nopriv_loadmore', 'true_load_posts');