Exemplo n.º 1
0
/**
 * DT master get image function. 
 *
 * @param $opts array
 *
 * @return string
 */
function dt_get_thumb_img( $opts = array() ) {
	global $post;

	$default_image = presscore_get_default_image();

	$defaults = array(
		'wrap'				=> '<a %HREF% %CLASS% %TITLE% %CUSTOM%><img %SRC% %IMG_CLASS% %SIZE% %ALT% %IMG_TITLE% /></a>',
		'class'         	=> '',
		'alt'				=> '',
		'title'         	=> '',
		'custom'        	=> '',
		'img_class'     	=> '',
		'img_title'			=> '',
		'img_description'	=> '',
		'img_caption'		=> '',
		'href'				=> '',
		'img_meta'      	=> array(),
		'img_id'			=> 0,
		'options'    		=> array(),
		'default_img'		=> $default_image,
		'prop'				=> false,
		'echo'				=> true
	);
	$opts = wp_parse_args( $opts, $defaults );
	$opts = apply_filters('dt_get_thumb_img-args', $opts);

	$original_image = null;
	if ( $opts['img_meta'] ) {
		$original_image = $opts['img_meta'];
	} elseif ( $opts['img_id'] ) {
		$original_image = wp_get_attachment_image_src( $opts['img_id'], 'full' );
	}

	if ( !$original_image ) {
		$original_image = $opts['default_img'];
	}

	// proportion
	if ( $original_image && !empty($opts['prop']) && ( empty($opts['options']['h']) || empty($opts['options']['w']) ) ) {
		$_prop = $opts['prop'];
		$_img_meta = $original_image;

		if ( $_prop > 1 ) {
			$h = intval(floor($_img_meta[1] / $_prop));
			$w = intval(floor($_prop * $h));
		} else if ( $_prop < 1 ) {
			$w = intval(floor($_prop * $_img_meta[2]));
			$h = intval(floor($w / $_prop));
		} else {
			$w = $h = min($_img_meta[1], $_img_meta[2]);
		}

		if ( !empty($opts['options']['w']) ) {
			$__prop = $h / $w;
			$w = intval($opts['options']['w']);
			$h = intval(floor($__prop * $w));
		} else if ( !empty($opts['options']['h']) ) {
			$__prop = $w / $h;
			$h = intval($opts['options']['h']);
			$w = intval(floor($__prop * $h));
		}

		$opts['options']['w'] = $w;
		$opts['options']['h'] = $h;
	}

	if ( $opts['options'] ) {
		$resized_image = dt_get_resized_img( $original_image, $opts['options'] );
	} else {
		$resized_image = $original_image;
	}

	if ( $img_id = absint( $opts['img_id'] ) ) {

		if ( '' === $opts['alt'] ) {
			$opts['alt'] = get_post_meta( $img_id, '_wp_attachment_image_alt', true );
		}

		if ( '' === $opts['img_title'] ) {
			$opts['img_title'] = get_the_title( $img_id );
		}
	}

	$class = empty( $opts['class'] ) ? '' : 'class="' . esc_attr( trim($opts['class']) ) . '"';
	$title = empty( $opts['title'] ) ? '' : 'title="' . esc_attr( trim($opts['title']) ) . '"';
	$img_title = empty( $opts['img_title'] ) ? '' : 'title="' . esc_attr( trim($opts['img_title']) ) . '"';
	$img_class = empty( $opts['img_class'] ) ? '' : 'class="' . esc_attr( trim($opts['img_class']) ) . '"';

	$href = $opts['href'];
	if ( !$href ) {
		$href = $original_image[0];
	}

	$src = $resized_image[0];

	if ( empty($resized_image[3]) || !is_string($resized_image[3]) ) {
		$size = image_hwstring($resized_image[1], $resized_image[2]);
	} else {
		$size = $resized_image[3];
	}

	// $src = dt_make_image_src_ssl_friendly( $src );
	$src = str_replace( array(' '), array('%20'), $src );

	$output = str_replace(
		array(
			'%HREF%',
			'%CLASS%',
			'%TITLE%',
			'%CUSTOM%',
			'%SRC%',
			'%IMG_CLASS%',
			'%SIZE%',
			'%ALT%',
			'%IMG_TITLE%',
			'%RAW_TITLE%',
			'%RAW_ALT%',
			'%RAW_IMG_TITLE%',
			'%RAW_IMG_DESCRIPTION%',
			'%RAW_IMG_CAPTION'
		),
		array(
			'href="' . esc_url( $href ) . '"',
			$class,
			$title,
			strip_tags( $opts['custom'] ),
			'src="' . esc_url( $src ) . '"',
			$img_class,
			$size,
			'alt="' . esc_attr( $opts['alt'] ) . '"',
			$img_title,
			esc_attr( $opts['title'] ),
			esc_attr( $opts['alt'] ),
			esc_attr( $opts['img_title'] ),
			esc_attr( $opts['img_description'] ),
			esc_attr( $opts['img_caption'] )
		),
		$opts['wrap']
	);

	if ( $opts['echo'] ) {
		echo $output;
		return '';
	}

	return $output;
}
Exemplo n.º 2
0
    /**
     * Full Width slider two with awesome hovers.
     *
     * @since 1.0.0
     */
    function presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $options = array())
    {
        if (empty($attachments_data)) {
            return '';
        }
        $fields_white_list = array('arrows', 'title', 'meta', 'description', 'link', 'details', 'zoom');
        $default_options = array('mode' => 'default', 'under_image_buttons' => 'under_image', 'hover_animation' => 'fade', 'hover_bg_color' => 'accent', 'hover_content_visibility' => 'on_hover', 'background_under_posts' => 'disabled', 'content_aligment' => 'left', 'title' => '', 'link' => 'page', 'height' => 210, 'img_width' => null, 'img_zoom' => 0, 'echo' => false, 'style' => '', 'class' => array(), 'fields' => array('arrows', 'title', 'description', 'link', 'details'), 'popup' => 'single', 'container_attr' => '');
        $options = wp_parse_args($options, $default_options);
        // filter fields
        $options['fields'] = array_intersect($options['fields'], $fields_white_list);
        $link = in_array($options['link'], array('file', 'page', 'none')) ? $options['link'] : $default_options['link'];
        $show_content = array_intersect($options['fields'], array('title', 'meta', 'description', 'link', 'zoom', 'details')) && 'page' == $link;
        $slider_title = esc_html($options['title']);
        $is_new_hover = in_array($options['mode'], array('on_hoover_centered', 'on_dark_gradient', 'from_bottom'));
        $desc_on_hover = !in_array($options['mode'], array('default', 'under_image'));
        $defore_content = "\n\t\t" . '<div class="fs-entry-content">';
        $after_content = "\n\t\t" . '</div>';
        if (!is_array($options['class'])) {
            $options['class'] = explode(' ', (string) $options['class']);
        }
        // default class
        $options['class'][] = 'slider-wrapper';
        if ($desc_on_hover) {
            $options['class'][] = 'text-on-img';
        }
        // construct hover styles
        switch ($options['mode']) {
            case 'on_hoover_centered':
                $options['class'][] = 'hover-style-two';
                $defore_content .= '<div class="wf-table"><div class="wf-td">';
                $after_content = '</div></div>' . $after_content;
            case 'text_on_image':
                // add color
                if ('dark' == $options['hover_bg_color']) {
                    $options['class'][] = 'hover-color-static';
                }
                // add animation
                if ('move_to' == $options['hover_animation']) {
                    $options['class'][] = 'cs-style-1';
                } else {
                    if ('direction_aware' == $options['hover_animation']) {
                        $options['class'][] = 'hover-grid';
                    } else {
                        if ('fade' == $options['hover_animation']) {
                            $options['class'][] = 'hover-fade';
                        } else {
                            if ('move_from_bottom' == $options['hover_animation']) {
                                $options['class'][] = 'hover-grid-3D';
                            }
                        }
                    }
                }
                break;
            case 'on_dark_gradient':
                $options['class'][] = 'hover-style-one';
                // content visibility
                if ('always' == $options['hover_content_visibility']) {
                    $options['class'][] = 'always-show-info';
                }
                break;
            case 'from_bottom':
                $options['class'][] = 'hover-style-three';
                $options['class'][] = 'cs-style-3';
                // content visibility
                if ('always' == $options['hover_content_visibility']) {
                    $options['class'][] = 'always-show-info';
                }
                break;
            case 'under_image':
                $options['class'][] = 'description-under-image';
                if ('dark' == $options['hover_bg_color']) {
                    $options['class'][] = 'hover-color-static';
                }
                break;
        }
        if ('disabled' != $options['background_under_posts'] && 'under_image' == $options['mode']) {
            $options['class'][] = 'bg-on';
            if ('fullwidth' == $options['background_under_posts']) {
                $options['class'][] = 'fullwidth-img';
            }
        }
        if ('center' == $options['content_aligment']) {
            $options['class'][] = 'text-centered';
        }
        $file_link_class = 'dt-mfp-item mfp-image';
        if ('single' == $options['popup']) {
            $file_link_class .= ' dt-single-mfp-popup';
        } else {
            if ('gallery' == $options['popup']) {
                $options['class'][] = 'dt-gallery-container';
            }
        }
        $container_class = implode(' ', $options['class']);
        $style = $options['style'] ? ' style="' . esc_attr($options['style']) . '"' : '';
        $container_attr = $options['container_attr'] ? ' ' . $options['container_attr'] : '';
        $html = "\n" . '<div class="' . esc_attr($container_class) . '"' . $style . $container_attr . '>
							' . ($slider_title ? '<h2 class="fs-title">' . $slider_title . '</h2>' : '') . '
							<div class="frame fullwidth-slider">
								<ul class="clearfix">';
        $img_base_args = array('options' => array('h' => absint($options['height']), 'z' => $options['img_zoom']), 'wrap' => '<img %SRC% %IMG_CLASS% %SIZE% %ALT% />', 'img_class' => '', 'echo' => false);
        foreach ($attachments_data as $data) {
            if (empty($data['full'])) {
                continue;
            }
            if (array_key_exists('image_attachment_data', $data)) {
                $image_data = $data['image_attachment_data'];
            } else {
                $image_data = array('permalink' => get_permalink($data['ID']), 'title' => get_the_title($data['ID']), 'description' => wp_kses_post(get_post_field('post_content', $data['ID'])));
            }
            if ($options['img_width']) {
                $img_base_args['options']['w'] = absint($options['img_width']);
            }
            $slide_classes = array('fs-entry-slide');
            $content_html = '';
            $post_buttons = '';
            $buttonts_count = 0;
            if ('none' != $link && $show_content) {
                if (in_array('title', $options['fields']) && !empty($data['title'])) {
                    $title = $data['title'];
                    if (!$is_new_hover) {
                        $title = '<a href="' . esc_url($data['permalink']) . '">' . $title . '</a>';
                    }
                    $content_html .= "\n\t\t\t" . '<h4>' . $title . '</h4>';
                }
                if (in_array('meta', $options['fields']) && !empty($data['meta'])) {
                    $post_meta_info = $data['meta'];
                    if ($is_new_hover) {
                        $post_meta_info = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", 'javascript: void(0);', $post_meta_info);
                    }
                    $content_html .= "\n\t\t\t" . $post_meta_info;
                }
                if (in_array('description', $options['fields']) && !empty($data['description'])) {
                    $content_html .= "\n\t\t\t" . wpautop($data['description']);
                }
                if (in_array('link', $options['fields']) && !empty($data['link'])) {
                    $buttonts_count++;
                    $post_buttons .= $data['link'];
                }
                if (in_array('zoom', $options['fields'])) {
                    $buttonts_count++;
                    $zoom_classes = 'project-zoom ';
                    $zoom_href = $data['full'];
                    if ('single' == $options['popup']) {
                        $zoom_classes .= ' dt-single-mfp-popup dt-mfp-item';
                        if (!empty($data['video_url'])) {
                            $zoom_href = $data['video_url'];
                            $zoom_classes .= ' mfp-iframe';
                        } else {
                            $zoom_classes .= ' mfp-image';
                        }
                    } else {
                        if ('gallery' == $options['popup']) {
                            $zoom_classes .= ' dt-trigger-first-mfp';
                        }
                    }
                    if ('default' == $options['mode']) {
                        $zoom_classes .= ' btn-zoom';
                    }
                    $post_buttons .= sprintf('<a href="%s" class="%s" title="%s" data-dt-img-description="%s">%s</a>', esc_url($zoom_href), $zoom_classes, esc_attr($image_data['title']), esc_attr($image_data['description']), __('Zoom', 'the7mk2'));
                }
                if (in_array('details', $options['fields'])) {
                    $buttonts_count++;
                    $post_buttons .= '<a class="project-details" href="' . esc_url($data['permalink']) . '">' . _x('Details', 'fullscreen slider two', 'the7mk2') . '</a>';
                }
                // add big class to button
                if (1 == $buttonts_count) {
                    $post_buttons = str_replace('class="', 'class="big-link ', $post_buttons);
                }
                // add buttons cover
                if ($post_buttons) {
                    $post_buttons = '<div class="links-container">' . $post_buttons . '</div>';
                }
                // add hovers html
                if ($is_new_hover) {
                    if ('from_bottom' == $options['mode']) {
                        $content_html = '<div class="rollover-content-wrap">' . $content_html . '</div>';
                    }
                    $content_html = '<div class="rollover-content-container">' . $content_html . '</div>';
                    $content_html = $post_buttons . $content_html;
                } else {
                    if ('text_on_image' == $options['mode'] || 'default' == $options['mode'] && in_array($options['under_image_buttons'], array('under_image', 'on_hoover_under'))) {
                        $content_html .= $post_buttons;
                    }
                }
                // .fs-entry-content
                $content_html = $defore_content . $content_html . $after_content;
            }
            $before_image = '';
            $after_image = '</div>';
            $img_args = array('img_meta' => array($data['full'], $data['width'], $data['height']), 'title' => $data['description'], 'alt' => $data['alt']);
            switch ($link) {
                case 'page':
                    $before_image = '<div class="fs-entry-img" data-dt-link="' . esc_url($data['permalink']) . '">';
                    break;
                case 'file':
                    // add anchor to image
                    $img_args['wrap'] = sprintf('<a href="%s" class="%s" title="%%RAW_ALT%%" data-dt-img-description="%%RAW_TITLE%%">%s</a>', $data['full'], esc_attr($file_link_class), $img_base_args['wrap']);
                default:
                    $before_image = '<div class="fs-entry-img">';
            }
            $image = dt_get_thumb_img(array_merge($img_base_args, $img_args));
            if (0 == $buttonts_count) {
                $slide_classes[] = 'forward-post';
            } else {
                if ($buttonts_count < 2) {
                    $slide_classes[] = 'rollover-active';
                }
            }
            if ($post_buttons && $image && !$desc_on_hover && in_array($options['under_image_buttons'], array('on_hoover_under', 'on_hoover'))) {
                $image = sprintf('%s<div class="fs-entry-content buttons-on-img"><div class="wf-table"><div class="wf-td">%s</div></div></div>', $image, $post_buttons);
            }
            $image_dimesions = dt_get_resized_img($img_args['img_meta'], $img_base_args['options'], false);
            $html .= "\n\t" . '<li class="fs-entry ts-cell" data-width="' . $image_dimesions[1] . '" data-height="' . $image_dimesions[2] . '">';
            $html .= sprintf('<div class="%s">%s</div>', implode(' ', $slide_classes), $before_image . $image . $after_image . $content_html);
            $html .= "\n\t" . '</li>';
        }
        $html .= "\n" . '</ul>';
        $html .= '</div>';
        // frame fullwidth-slider
        if (in_array('arrows', $options['fields'])) {
            $html .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
        }
        $html .= '</div>';
        if ($options['echo']) {
            echo $html;
        }
        return $html;
    }
Exemplo n.º 3
0
                    <h2><?php 
                _e('Related Items', LANGUAGE_ZONE);
                ?>
</h2>
            
                    <?php 
                if ('same' == $rel_works['related']) {
                    $rel_works['related'] = wp_get_post_terms($post->ID, 'dt_catalog_category', array('fields' => 'ids'));
                }
                $dt_tmp_query = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'dt_catalog', 'post_status' => 'publish', 'post__not_in' => array($post->ID), 'tax_query' => array(array('taxonomy' => 'dt_catalog_category', 'field' => 'id', 'terms' => $rel_works['related'], 'operator' => 'IN'))));
                if ($dt_tmp_query->have_posts()) {
                    $thumb_arr = dt_core_get_posts_thumbnails($dt_tmp_query->posts);
                    $items = array();
                    foreach ($dt_tmp_query->posts as $rel_post) {
                        $item = array();
                        $img = dt_get_resized_img(dt_get_thumb_meta($thumb_arr['thumbs_meta'], 'full', $rel_post->ID), array('w' => 223, 'h' => 140, 'use_noimage' => true));
                        $item['src'] = $img[0];
                        $item['size_str'] = $img[3];
                        $item['post_id'] = $rel_post->ID;
                        $img_id = get_post_thumbnail_id($rel_post->ID);
                        // get alt
                        $img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true);
                        if (!$img_alt) {
                            $img_alt = get_the_title($rel_post->ID);
                        }
                        $item['desc'] = apply_filters('get_the_excerpt', $rel_post->post_excerpt);
                        $item['title'] = apply_filters('the_title', $rel_post->post_title, $rel_post->ID);
                        $item['alt'] = esc_attr($img_alt);
                        $items[] = $item;
                    }
                    $args = array('items_arr' => $items, 'id' => '', 'class' => 'list-carousel recent bx', 'ul_class' => 'slider1');
Exemplo n.º 4
0
function dt_get_images_in($dir = '', $one_img_dir = '')
{
    //    $noimage = get_stylesheet_directory_uri(). '/images/noimage_small.jpg';
    $noimage = '/images/noimage_small.jpg';
    $basedir = dirname(__FILE__) . '/../../../';
    $dirname = $basedir . $dir;
    $res = $full_dir = $thumbs_dir = array();
    $res['none'] = $noimage;
    // full dir
    if (file_exists($dirname . '/full') && ($handle = opendir($dirname . '/full'))) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != 'Thumb.db' && $file != 'Thumbs.db' && $file != '.DS_Store' && preg_match('/[.jpeg|.jpg|.png|.gif]$/', $file)) {
                $f_name = preg_split('/\\.[^.]+$/', $file);
                $full_dir[$f_name[0]] = $file;
            }
        }
        closedir($handle);
    }
    unset($file);
    // thumbs dir
    if (file_exists($dirname . '/thumbs') && ($handle = opendir($dirname . '/thumbs'))) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != 'Thumb.db' && $file != 'Thumbs.db') {
                $f_name = preg_split('/\\.[^.]+$/', $file);
                $thumbs_dir[$f_name[0]] = $file;
            }
        }
        closedir($handle);
    }
    unset($file);
    asort($full_dir);
    foreach ($full_dir as $name => $file) {
        $full_link = '/' . $dir . '/full/' . $file;
        if (array_key_exists($name, $thumbs_dir)) {
            $thumb_link = '/' . $dir . '/thumbs/' . $thumbs_dir[$name];
        } else {
            $one_img = explode('_', $name);
            if ($one_img[0] != $name && $one_img_dir && file_exists($basedir . $one_img_dir . '/' . $one_img[0] . '.png')) {
                $thumb_link = '/' . $one_img_dir . '/' . $one_img[0] . '.png';
            }
            if ($one_img[0] != $name && $one_img_dir && file_exists($basedir . $one_img_dir . '/' . $one_img[0] . '.jpg')) {
                $thumb_link = '/' . $one_img_dir . '/' . $one_img[0] . '.jpg';
            }
            if (!isset($thumb_link)) {
                $thumb_meta = dt_get_resized_img(array(get_template_directory_uri() . $full_link, 1000, 1000), array('w' => 119, 'h' => 119, 'z' => 3));
                $thumb_link = str_replace(get_template_directory_uri(), '', $thumb_meta[0]);
            }
        }
        $res[$full_link] = $thumb_link;
    }
    return $res;
}
Exemplo n.º 5
0
            <h2><?php 
    _e('Related Projects', LANGUAGE_ZONE);
    ?>
</h2>

            <?php 
    if ('same' == $rel_works['related']) {
        $rel_works['related'] = wp_get_post_terms($post->ID, 'dt_portfolio_category', array('fields' => 'ids'));
    }
    $dt_tmp_query->query(array('posts_per_page' => -1, 'post_type' => 'dt_portfolio', 'post_status' => 'publish', 'post__not_in' => array($post->ID), 'tax_query' => array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'id', 'terms' => $rel_works['related'], 'operator' => 'IN'))));
    if ($dt_tmp_query->have_posts()) {
        $thumb_arr = dt_core_get_posts_thumbnails($dt_tmp_query->posts);
        $items = array();
        foreach ($dt_tmp_query->posts as $rel_post) {
            $item = array();
            $img = dt_get_resized_img(dt_get_thumb_meta($thumb_arr['thumbs_meta'], 'full', $rel_post->ID), array('w' => 225, 'h' => 140));
            $img_id = get_post_thumbnail_id($rel_post->ID);
            // get alt
            $img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true);
            if (!$img_alt) {
                $img_alt = get_the_title($rel_post->ID);
            }
            $item['src'] = $img[0];
            $item['size_str'] = $img[3];
            $item['post_id'] = $rel_post->ID;
            $item['desc'] = apply_filters('get_the_excerpt', $rel_post->post_excerpt);
            $item['title'] = apply_filters('the_title', $rel_post->post_title, $rel_post->ID);
            $item['alt'] = esc_attr($img_alt);
            $items[] = $item;
        }
        $args = array('items_arr' => $items, 'id' => 'foo1', 'ul_class' => 'slider1');
Exemplo n.º 6
0
echo dt_get_container_class();
?>
>
            
            <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

            <?php 
        global $post;
        $big = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
        $big[3] = image_hwstring($big[1], $big[2]);
        if ($big[1] > 960) {
            $thumb = dt_get_resized_img($big, array('w' => 960));
            printf('<a class="alignleft highslide" href="%1$s" onclick="return hs.expand(this)"><img src="%2$s" %3$s alt="%4$s" /></a>', $big[0], $thumb[0], $thumb[3], get_the_excerpt());
        } else {
            printf('<img class="alignleft" src="%1$s" %2$s alt="%3$s" />', $big[0], $big[3], get_the_excerpt());
        }
        the_content();
        if (dt_is_page_soc_buttons_enabled('photo')) {
            dt_get_like_buttons(get_the_ID());
        }
        ?>

            <?php 
    }
}
?>
Exemplo n.º 7
0
function dt_get_thumb_img($opts = array(), $wrap = '', $echo = true)
{
    global $post;
    // get default href and src for thumbnail
    if (!isset($opts['img_meta'])) {
        $big = dt_get_thumb_meta(dt_storage('thumbs_array'));
    } else {
        $big = $opts['img_meta'];
    }
    // this is question
    if (isset($opts['thumb_opts']) && (!empty($big) || !empty($opts['use_noimage']))) {
        $img = dt_get_resized_img($big, $opts['thumb_opts']);
    } elseif (!isset($opts['thumb_opts'])) {
        $img = $big;
        $img[3] = image_hwstring($img[1], $img[2]);
    } else {
        $big[0] = '#';
        $img[0] = $img[3] = null;
    }
    if (empty($wrap)) {
        $wrap = '<a %HREF% %CLASS% %TITLE% %CUSTOM%><img %SRC% %IMG_CLASS% %SIZE% %ALT% /></a>';
    }
    $defaults = array('class' => 'post thumbnail', 'alt' => isset($post) ? $post->post_title : '', 'custom' => '', 'img_class' => '', 'img_meta' => '', 'thumb_opts' => array(), 'title' => isset($post) ? $post->post_title : '', 'size' => $img[3], 'href' => $big[0], 'src' => $img[0]);
    $opts = wp_parse_args($opts, $defaults);
    if (!$opts['src']) {
        return false;
    }
    $output = str_replace(array('%HREF%', '%CLASS%', '%TITLE%', '%CUSTOM%', '%SRC%', '%IMG_CLASS%', '%SIZE%', '%ALT%'), array('href="' . esc_url($opts['href']) . '"', 'class="' . esc_attr($opts['class']) . '"', 'title="' . esc_attr($opts['title']) . '"', strip_tags($opts['custom']), 'src="' . esc_url($opts['src']) . '"', 'class="' . esc_attr($opts['img_class']) . '"', $opts['size'], 'alt="' . esc_attr($opts['alt']) . '"'), $wrap);
    if ($echo) {
        echo $output;
    }
    return $output;
}
Exemplo n.º 8
0
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;
}
Exemplo n.º 9
0
    }
    $thmb_args = array('w' => 210, 'h' => 210);
    $classes = array('alignleft', 'highslide');
    $thumb_pattern = '<a class="%6$s" href="%1$s"  onclick="return hs.expand(this)"><img src="%2$s" %3$s alt="%5$s" title="%4$s" /></a>';
    if ('image' == get_post_format()) {
        $t_w = 710;
        $thmb_args = array('w' => $t_w);
        $classes[] = 'img-posts';
        if ($big[1] <= $t_w) {
            $classes = array('alignleft');
            $thmb_args = array();
            $thumb_pattern = '<span class="%6$s"><img src="%2$s" %3$s alt="%5$s" title="%4$s" /></span>';
        }
    }
    $classes = implode(' ', $classes);
    $thumb = dt_get_resized_img($big, $thmb_args);
    printf($thumb_pattern, $big[0], $thumb[0], $thumb[3], get_the_title(), $alt, $classes);
}
the_content();
wp_link_pages();
dt_get_taxonomy_link('post_tag', '<p><span class="ico-link tags">%CAT_LIST%</span></p>');
if (dt_is_page_soc_buttons_enabled('post')) {
    dt_get_like_buttons(get_the_ID());
}
?>

<?php 
if (of_get_option('misc-show_author_details')) {
    ?>

<p class="gap"></p>