$video = get_post_meta($slide->ID, '_dt_catalog_video_link', true); $tmp_arr = array(); $tmp_arr['caption'] = $slide->post_excerpt; if (!$video) { $slide_src = dt_get_resized_img(wp_get_attachment_image_src($slide->ID, 'full'), array('w' => 710)); $tmp_arr['alt'] = get_post_meta($slide->ID, '_wp_attachment_image_alt', true); $tmp_arr['src'] = $slide_src[0]; $tmp_arr['size_str'] = $slide_src[3]; } else { $tmp_arr['is_video'] = true; $tmp_arr['src'] = $video; $tmp_arr['size_str'] = array(710, 1024); } $slides[] = $tmp_arr; } dt_get_anything_slider(array('id' => 'slider2', 'items_arr' => $slides)); } } ?> <?php $opts = get_post_meta($post->ID, '_dt_catalog-goods_options', true); ?> <?php if (!empty($opts['price'])) { ?> <span class="price"><?php _e('Price: ', LANGUAGE_ZONE); echo esc_html($opts['price']);
function dt_shortcode_anything_slider($atts, $content = null) { extract(shortcode_atts(array('column' => 'half', 'title' => '', 'slider_id' => '', 'autoslide' => 0), $atts)); if ($title) { $title = '<h2>' . esc_html($title) . '</h2>'; } $autoslide_on = $autoslide ? 1 : 0; $args = array('posts_per_page' => 1, 'post_type' => 'dt_slider', 'post_status' => 'publish'); if ($slider_id) { $args['post__in'] = array($slider_id); } $p_query = new WP_Query($args); $sizes_full = array('one-fourth' => array(210), 'three-fourth' => array(710), 'one-third' => array(294), 'two-thirds' => array(628), 'half' => array(460), 'full-width' => array(960)); $sizes = array('one-fourth' => array(148), 'three-fourth' => array(524), 'one-third' => array(210), 'two-thirds' => array(460), 'half' => array(336), 'full-width' => array(710)); $img_width = null; if (!dt_storage('have_sidebar') && isset($sizes_full[$column])) { $img_width = current($sizes_full[$column]); } elseif (dt_storage('have_sidebar') && isset($sizes[$column])) { $img_width = current($sizes[$column]); } $error_text = ''; $slides_arr = array(); if ($p_query->have_posts()) { foreach ($p_query->posts as $album) { $args = array('posts_per_page' => -1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $album->ID, 'post_status' => 'inherit', 'orderby' => 'menu_order', 'order' => 'ASC'); $images = new WP_Query($args); global $post; if ($images->have_posts()) { while ($images->have_posts()) { $images->the_post(); $link = get_post_meta($post->ID, '_dt_slider_link', true); $hide_desc = get_post_meta($post->ID, '_dt_slider_hdesc', true); $link_neww = get_post_meta($post->ID, '_dt_slider_newwin', true); $tmp_arr = array(); if (!$hide_desc) { $tmp_arr['caption'] = get_the_excerpt(); } if (!empty($link)) { $tmp_arr['link'] = $link; } if (!empty($link_neww)) { $tmp_arr['link_neww'] = true; } if (!empty($post->post_title) && !$hide_desc) { $tmp_arr['title'] = $post->post_title; } $slide_src = dt_get_resized_img(wp_get_attachment_image_src($post->ID, 'full'), array('w' => $img_width)); $tmp_arr['src'] = $slide_src[0]; $tmp_arr['size_str'] = $slide_src[3]; $tmp_arr['alt'] = get_post_meta($post->ID, '_wp_attachment_image_alt', true); $slides_arr[] = $tmp_arr; } } else { $error_text .= '<div style="color: red; margin: 0 auto; padding: 20px; text-shadow: none; ">' . __('There are no images in the slider.', LANGUAGE_ZONE) . '</div>'; } } } wp_reset_postdata(); $slider = dt_get_anything_slider(array('items_arr' => $slides_arr, 'class' => 'slider-shortcode flexslider', 'wrap' => '<div class="%CLASS%" data-autoslide="' . $autoslide . '" data-autoslide_on="' . $autoslide_on . '">%SLIDER%</div>'), false); $output = '<div class="' . esc_attr($column) . '">' . $title . $slider . $error_text . '</div>'; return $output; }