You have to use this format:
FUNCTIONS.PHP
function theme_name_scripts() {
wp_enqueue_script( 'script-name', get_bloginfo('stylesheet_directory') . '/js/min.js', array(), '1.0.0', true );
wp_localize_script( 'script-name', 'ajax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );
}
function ajax_callback() {
get_event_list();
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
add_action('wp_ajax_ajax', 'ajax_callback');
add_action('wp_ajax_nopriv_ajax', 'ajax_callback');
AJAX:
$.get(
ajax.url,
{
'action': 'ajax',
'order' : 'DSC',
},
function( response, status ) {
$('ul.event-items').append(response);
}
);
You may use this line to explicitly include the wr_event
class:
<article id="event-<?php the_ID(); ?>" <?php echo event_canceled($post) ? post_class('wrapper canceled wr_event') : post_class('wrapper wr_event'); ?>>
and also add die();
at the end of the template file to avoid the zero displayed.