/** * Returns the output for a slide assigned to a slider */ public function assign_slide() { $action = $this->get_action_data('assign_slide'); check_ajax_referer($action['nonce']['action'], $action['nonce']['name']); $post_id = isset($_POST['post_id']) ? absint($_POST['post_id']) : -1; if (!current_user_can('edit_fa_items', $post_id)) { wp_die(-1); } $slider_id = absint($_POST['slider_id']); $post = get_post($post_id); $output = ''; if ($post) { if ('auto-draft' != $post->post_status) { ob_start(); fa_slide_panel($post_id, $slider_id); $output = ob_get_clean(); } } /** * Action on post assignment to slider. Will run every time a post is * set as a slide to a given slider. * * @param int $post_id - ID of post being assigned to slider */ do_action('fa_assign_post_to_slider', $post_id); wp_send_json_success($output); die; }
?> </a> <a id="" class="button button-secondary" href="#"><?php _e('Create custom slide', 'fapro'); ?> <?php fa_option_not_available(' '); ?> </a> <div id="fa-selected-posts"> <?php $posts = fa_get_slider_posts($post->ID, 'any'); if ($posts) { foreach ($posts as $slide_post) { fa_slide_panel($slide_post, $post->ID); } } else { ?> <p class="description"> <?php _e('No posts assigned. To select posts, pages or custom created slides, please click button above.', 'fapro'); ?> </p> <?php } ?> </div><!-- #fa-selected-posts --> <br class="clear" /> </div><!-- #fapro-content-mixed -->