Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Adiciona uma action Ajax para recuperar uma nova galeria, após a edição da meta_box
- add_action( 'wp_ajax_get_new_gallery', array( $this, 'wp_ajax_get_new_gallery_callback' ) );
- // A função
- function wp_ajax_get_new_gallery_callback() {
- // Checa a referência (wp_nonce)
- check_ajax_referer( 'seutema-gallery-nonce', 'seutema_ajax_gallery' );
- $response = array( 'status' => 'error' );
- if ( isset( $_POST['gallery_ids'] ) ) {
- $html = do_shortcode( '[gallery ids="' . $_POST['gallery_ids'] . '" columns="5" itemtag="li" icontag="div" captiontag="" link="none"]' );
- $response = array(
- 'status' => 'ok',
- 'response' => $html,
- );
- }
- wp_send_json( $response );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement