1 | 14,15d13 |
---|
2 | < |
---|
3 | < |
---|
4 | 28a27 |
---|
5 | > add_action( 'wp_ajax_nopriv_infinite_scroll' , array( $this, 'infinite_scroll_func' ) ); |
---|
6 | 37d35 |
---|
7 | < |
---|
8 | 49a48 |
---|
9 | > |
---|
10 | 53a53,71 |
---|
11 | > /** |
---|
12 | > * Infinite Scroll functionality added |
---|
13 | > */ |
---|
14 | > |
---|
15 | > public function infinite_scroll_func() { |
---|
16 | > $off = $_POST[ 'off' ]; |
---|
17 | > $off = $off + 1; |
---|
18 | > if ( $tempEvents = $this->get_meetup_events( $off ) ) { |
---|
19 | > usort( $tempEvents, array( $this, 'sort_events' ) ); |
---|
20 | > foreach ( $tempEvents as $event ) : |
---|
21 | > echo( ' |
---|
22 | > <li> |
---|
23 | > <a href="' . esc_attr( esc_url( $event->url ) ) . '">' . esc_html( $event->title ) . '</a><br />' . |
---|
24 | > esc_html( date( "l, F jS | g:i a", (int) $event->start_timestamp ) ).'<br />'. |
---|
25 | > esc_html( $event->location ) . '</li>' ); |
---|
26 | > endforeach; |
---|
27 | > } |
---|
28 | > wp_die(); |
---|
29 | > } |
---|
30 | 79a98 |
---|
31 | > |
---|
32 | 107c126 |
---|
33 | < * |
---|
34 | --- |
---|
35 | > * @param $offset |
---|
36 | 110c129 |
---|
37 | < protected function get_meetup_events() { |
---|
38 | --- |
---|
39 | > protected function get_meetup_events( $offset = 0 ) { |
---|
40 | 112d130 |
---|
41 | < |
---|
42 | 116d133 |
---|
43 | < |
---|
44 | 118c135 |
---|
45 | < '%s2/events?group_id=%s&time=0,1m&page=%d&key=%s', |
---|
46 | --- |
---|
47 | > '%s2/events?group_id=%s&time=0,1m&page=%d&offset=%d&key=%s', |
---|
48 | 121a139 |
---|
49 | > $offset, |
---|
50 | 179d196 |
---|
51 | < |
---|
52 | 246,248c263,264 |
---|
53 | < |
---|
54 | < require_once( __DIR__ . DIRECTORY_SEPARATOR . 'official-wordpress-event.php' ); |
---|
55 | < $GLOBALS['Official_WordPress_Events'] = new Official_WordPress_Events(); |
---|
56 | --- |
---|
57 | > require_once( __DIR__ . DIRECTORY_SEPARATOR . 'official-wordpress-event.php' ); |
---|
58 | > $GLOBALS['Official_WordPress_Events'] = new Official_WordPress_Events(); |
---|