Activity_Helper::_ajax_more_activities()

Description #

Callback for loading more activities.

Source #

File: includes/class/class-activity-helper.php

	public static function _ajax_more_activities() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
		// Check ajax referer.
		if ( ! check_ajax_referer( 'load_activities', '__nonce', false ) ) {
			ap_ajax_json( 'something_wrong' );
		}

		$activities = new \AnsPress\Activity(
			array(
				'paged' => max( 1, ap_isset_post_value( 'paged', 1 ) ),
			)
		);

		ob_start();
		include ap_get_theme_location( 'activities/activities.php' );
		$html = ob_get_clean();

		ap_ajax_json(
			array(
				'success' => true,
				'html'    => $html,
				'cb'      => 'loadedMoreActivities',
			)
		);
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment