Example #1
0
/**
 * Images column for posr type
 */
function st_manage_post_type_columns($column_name, $id)
{
    global $wpdb;
    $size = 'st_small_thumb';
    switch ($column_name) {
        case 'images':
            $html = '';
            $st_page_options = get_page_builder_options($id);
            //  echo get_the_post_thumbnail($id,array(40,40));
            switch (strtolower($st_page_options['thumbnail_type'])) {
                case 'video':
                    $video = st_get_video($st_page_options['video_code'], $data);
                    $html = '<span class="video-thumb" video="' . $data['type'] . '" size=' . $size . ' video-id="' . $data['video_id'] . '"></span>';
                    break;
                case 'slider':
                    if (count($st_page_options['thumbnails']['images'])) {
                        foreach ($st_page_options['thumbnails']['images'] as $img_id) {
                            $thumb_image_url = wp_get_attachment_image_src($img_id, $size);
                            $post_title = get_the_title($post_id);
                            $html .= '  <img alt="' . esc_attr($post_title) . '" src="' . $thumb_image_url[0] . '" >';
                        }
                    }
                    break;
                default:
                    if (has_post_thumbnail($post_id)) {
                        $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
                        $post_title = get_the_title($post_id);
                        $html = '  <img alt="' . esc_attr($post_title) . '" src="' . $thumb_image_url[0] . '" >';
                    } else {
                    }
            }
            echo $html;
            break;
        default:
            break;
    }
    // end switch
}
Example #2
0
 /**
  * PB Item Video
  */
 function st_video_func($atts, $content = '')
 {
     $atts = shortcode_atts(array('video' => '', 'ratio' => '', 'width' => '', 'height' => '', 'no_fit' => '', 'style' => ''), $atts);
     extract($atts);
     if ($ratio == 'custom') {
         $rt = (int) $width . ':' . (int) $height;
     } else {
         $rt = $ratio;
     }
     $html = $attrs = '';
     $r = '';
     if ($no_fit === false || $no_fit == 'no-fit') {
         $attrs .= ' class="no-fit" ';
     }
     if ($style != '') {
         $attrs .= ' style="' . $style . '" ';
     }
     $content = st_get_video($video, $rt, $r, $attrs);
     $html .= $content != '' ? '<div class="st-video">' . $content . '</div>' : '';
     $html = apply_filters('st_video_func', $html, $atts);
     return $html;
 }
Example #3
0
function st_video_func($atts, $content = '')
{
    $link = $atts['link'];
    if ($link == '') {
        return '';
    } else {
        return st_get_video($link) . '<div class="video-shadow"></div>';
    }
}
Example #4
0
function st_post_thumbnail_gallery($post_id = '', $size = 'st_medium')
{
    if (empty($size) || $size == '') {
        $size = 'st_medium';
    }
    $st_page_options = get_page_builder_options($post_id);
    $html = '';
    $title = esc_attr(get_the_title($post_id));
    $link = get_permalink($post_id);
    switch (strtolower($st_page_options['thumbnail_type'])) {
        case 'video':
            $html = st_get_video($st_page_options['video_code'], $data);
            break;
        case 'slider':
            if (count($st_page_options['thumbnails']['images'])) {
                $first_img = '';
                $list_img = array();
                $gallery_id = 'gl' . uniqid();
                $i = 0;
                $img_0 = '';
                foreach ($st_page_options['thumbnails']['images'] as $thumb_id) {
                    if ($i == 0) {
                        $thumb_image_url_0 = wp_get_attachment_image_src($thumb_id, $size);
                        $img_0 = $thumb_image_url_0[0];
                    }
                    // for light box
                    $thumb_image_url = wp_get_attachment_image_src($thumb_id, 'full');
                    $list_img[] = $thumb_image_url[0];
                    $i++;
                }
                $html = '';
                if ($list_img) {
                    $html = '<img src="' . $img_0 . '" alt="">
                                <div class="thumb-control-wrapper">
                                    <ul class="thumb-control clearfix">
                                        <li><a title="' . __('View Detail', 'smooththemes') . '" href="' . $link . '" class="go-detail">' . __('Open Detail', 'smooththemes') . '</a></li>
                                        <li><a rel="prettyPhoto[' . $gallery_id . ']" title="' . $title . '" href="' . $list_img[0] . '" class="go-gallery">' . __('Open Gallery', 'smooththemes') . '</a></li>
                                        ';
                    unset($list_img[0]);
                    if (count($list_img)) {
                        $html .= '<div style="display:none">';
                        foreach ($list_img as $src) {
                            $html .= '<a rel="prettyPhoto[' . $gallery_id . ']" title="' . $title . '" href="' . $src . '"></a>';
                        }
                        $html .= '</div>';
                    }
                    $html .= '</ul>
                                </div>';
                }
            }
            break;
        default:
            if (has_post_thumbnail($post_id)) {
                $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
                $thumb_image_url = $thumb_image_url[0];
                $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
                $full_image_url = $full_image_url[0];
                $html = '<img src="' . $thumb_image_url . '" alt="">
                            <div class="thumb-control-wrapper">
                                <ul class="thumb-control clearfix">
                                    <li><a title="View Detail" href="' . $link . '" class="go-detail">' . __('Open Detail', 'smooththemes') . '</a></li>
                                    <li><a rel="prettyPhoto" title="' . $title . '" href="' . $full_image_url . '" class="go-gallery">' . __('Open Gallery', 'smooththemes') . '</a></li>
                                </ul>
                            </div>';
            }
    }
    return apply_filters('st_post_thumbnail_gallery', $html, $post_id, $size);
}