[app_mc_carousel id="'.$post_id.'"]'; break; case 'wp_amc_photos': $total_photos = get_post_meta($post_id, $prefix.'gallery_id', true); echo !empty($total_photos) ? count($total_photos) : '--'; break; } } /** * Function to add custom quick links at post listing page * * @package Swiper Slider and Carousel * @since 1.0.0 */ function wp_amc_add_post_row_data( $actions, $post ) { if( $post->post_type == WP_AMC_POST_TYPE ) { return array_merge( array( 'wp_amc_id' => 'ID: ' . $post->ID ), $actions ); } return $actions; } /** * Image data popup HTML * * @package Swiper Slider and Carousel * @since 1.0.0 */ function wp_amc_image_update_popup_html() { global $post_type; $registered_posts = array(WP_AMC_POST_TYPE); // Getting registered post types if( in_array($post_type, $registered_posts) ) { include_once( WP_AMC_DIR .'/includes/admin/settings/wp-amc-img-popup.php'); } } /** * Get attachment edit form * * @package Swiper Slider and Carousel * @since 1.0.0 */ function wp_amc_get_attachment_edit_form() { // Taking some defaults $result = array(); $result['success'] = 0; $result['msg'] = __('Sorry, Something happened wrong.', 'app-mockups-carousel'); $attachment_id = !empty($_POST['attachment_id']) ? trim($_POST['attachment_id']) : ''; if( !empty($attachment_id) ) { $attachment_post = get_post( $_POST['attachment_id'] ); if( !empty($attachment_post) ) { ob_start(); // Popup Data File include( WP_AMC_DIR . '/includes/admin/settings/wp-amc-img-popup-data.php' ); $attachment_data = ob_get_clean(); $result['success'] = 1; $result['msg'] = __('Attachment Found.', 'app-mockups-carousel'); $result['data'] = $attachment_data; } } echo json_encode($result); exit; } /** * Get attachment edit form * * @package Swiper Slider and Carousel * @since 1.0.0 */ function wp_amc_save_attachment_data() { $prefix = WP_AMC_META_PREFIX; $result = array(); $result['success'] = 0; $result['msg'] = __('Sorry, Something happened wrong.', 'app-mockups-carousel'); $attachment_id = !empty($_POST['attachment_id']) ? trim($_POST['attachment_id']) : ''; $form_data = parse_str($_POST['form_data'], $form_data_arr); if( !empty($attachment_id) && !empty($form_data_arr) ) { // Getting attachment post $wp_amc_attachment_post = get_post( $attachment_id ); // If post type is attachment if( isset($wp_amc_attachment_post->post_type) && $wp_amc_attachment_post->post_type == 'attachment' ) { $post_args = array( 'ID' => $attachment_id, 'post_title' => !empty($form_data_arr['wp_amc_attachment_title']) ? $form_data_arr['wp_amc_attachment_title'] : $wp_amc_attachment_post->post_name, 'post_content' => $form_data_arr['wp_amc_attachment_desc'], 'post_excerpt' => $form_data_arr['wp_amc_attachment_caption'], ); $update = wp_update_post( $post_args, $wp_error ); if( !is_wp_error( $update ) ) { update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_amc_slashes_deep($form_data_arr['wp_amc_attachment_alt']) ); update_post_meta( $attachment_id, $prefix.'attachment_link', wp_amc_slashes_deep($form_data_arr['wp_amc_attachment_link']) ); $result['success'] = 1; $result['msg'] = __('Your changes saved successfully.', 'app-mockups-carousel'); } } } echo json_encode($result); exit; } } $wp_amc_admin = new Wp_Amc_Admin();