function st_ajax_gallery_details() { $post_id = intval($_REQUEST['galleryID']); $title = $date = $tags = $desc = ''; $images = array(); global $post, $wpdb; $prev_post_id = $next_post_id = ''; $post = get_post($post_id); if ($post->ID > 0) { setup_postdata($post); $title = get_the_title(); $term_list = wp_get_post_terms($post->ID, 'gallery_tag', array("fields" => "all")); $filter_class = array(); $tags = array(); foreach ($term_list as $term) { $filter_class[] = $term->slug; $tags[] = $term->name; } $tags = !empty($tags) ? join(esc_html(', '), $tags) : ''; $desc = get_the_content(''); $date = get_the_date(); $next_post_id = $wpdb->get_var("\r\t\t\t \t\tSELECT `ID` FROM {$wpdb->posts}\r\t\t\t \t\tWHERE `post_type` LIKE 'gallery'\r\t\t\t\t \t\tAND `post_status` LIKE 'publish'\r\t\t\t \t\t\tAND `ID` > ({$post->ID})\r\t\t\t \t\tORDER BY `ID` ASC LIMIT 1 \r\r\t\t \t\t"); $prev_post_id = $wpdb->get_var("\r\t\t\t \t\tSELECT `ID` FROM {$wpdb->posts}\r\t\t\t \t\tWHERE `post_type` LIKE 'gallery'\r\t\t\t\t \t\tAND `post_status` LIKE 'publish'\r\t\t\t\t \t\tAND `ID` < ({$post->ID})\r\t\t\t \t\tORDER BY `ID` DESC LIMIT 1\r\t\t \t\t"); $image_data = st_get_gallery_images($post->ID); if (!count($image_data)) { $image_data = array(); } foreach ($image_data['images'] as $k => $thumb_id) { $meta = $image_data['meta'][$k]; // for light box $thumb_image_url = wp_get_attachment_image_src($thumb_id, 'st_large'); $thumb_image_url = $thumb_image_url[0]; $full_image_url = wp_get_attachment_image_src($thumb_id, 'full'); $full_image_url = $full_image_url[0]; $images[$k]['src'] = $thumb_image_url; $images[$k]['title'] = stripslashes($meta['title']); $images[$k]['src_full'] = $full_image_url; } } $ajax_gallery = array('desc' => ' <h2 class="g-title">' . $title . '</h2> <div class="g-meta"> <div class="g-meta-date">' . sprintf(__('Date: %s', 'smooththemes'), $date) . '</div> <div class="g-meta-cat">' . sprintf(__('Tags: %s', 'smooththemes'), $tags) . '</div> </div> <div class="g-desc">' . $desc . '</div> ', 'next_url' => '#', 'back_url' => '#', 'ajax_next' => '', 'ajax_back' => '', 'images' => $images); if ($next_post_id != '') { $ajax_gallery['ajax_next'] = 'action=ajax_gallery_details&galleryID=' . $next_post_id;
} } break; case 'slider': if (count($st_page_options['thumbnails']['images'])) { if ($rand_if_slider === true || $size == 'st_small_thumb') { // show rand image $rand_key = array_rand($st_page_options['thumbnails']['images'], 1); $thumb_image_url = wp_get_attachment_image_src($st_page_options['thumbnails']['images'][$rand_key], $size); $title = 'title="' . esc_attr(sprintf(__('Permalink to %s', 'smooththemes'), get_the_title($post_id))) . '" rel="bookmark" '; $html = '<span class="had-thumb"> <a href="' . get_permalink($post_id) . '" ' . $title . '><img alt="" src="' . $thumb_image_url[0] . '" ></a> </span>'; } else { $slider_data = array_merge(array('slider_items' => $st_page_options['thumbnails']), array('show_caption' => 'no', 'class' => 'portfolio-slider-wrapper', 'size' => $size)); $slider_data['show_slider'] = 1;