bp_nouveau_ajax_albums_loader()
Load the template loop for the albums object.
Description
Return
(string) Template loop for the albums object
Source
File: bp-templates/bp-nouveau/includes/media/ajax.php
function bp_nouveau_ajax_albums_loader() { $response = array( 'feedback' => sprintf( '<div class="bp-feedback error bp-ajax-message"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>', esc_html__( 'There was a problem performing this action. Please try again.', 'buddyboss' ) ), ); // Bail if not a POST action. if ( ! bp_is_post_request() ) { wp_send_json_error( $response ); } if ( empty( $_POST['_wpnonce'] ) ) { wp_send_json_error( $response ); } // Use default nonce $nonce = $_POST['_wpnonce']; $check = 'bp_nouveau_media'; // Nonce check! if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, $check ) ) { wp_send_json_error( $response ); } $page = ! empty( $_POST['page'] ) ? (int) $_POST['page'] : 1; ob_start(); if ( bp_has_albums( array( 'page' => $page ) ) ) { while ( bp_album() ) { bp_the_album(); bp_get_template_part( 'media/album-entry' ); } if ( bp_album_has_more_items() ) : ?> <li class="load-more"> <a class="button outline" href="<?php bp_album_has_more_items(); ?>"><?php esc_html_e( 'Load More', 'buddyboss' ); ?></a> </li> <?php endif; } $albums = ob_get_contents(); ob_end_clean(); wp_send_json_success( array( 'albums' => $albums, ) ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.