Пример #1
1
 function widget($args, $instance)
 {
     $this->dt_hs_group++;
     $instance = wp_parse_args((array) $instance, self::$default_instance);
     extract($args);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $args = array('no_found_rows' => 1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats'])));
     switch ($instance['select']) {
         case 'only':
             $args['tax_query'][0]['operator'] = 'IN';
             break;
         case 'except':
             $args['tax_query'][0]['operator'] = 'NOT IN';
             break;
         default:
             unset($args['tax_query']);
     }
     add_filter('posts_clauses', 'dt_core_join_left_filter');
     $g_query = new Wp_Query($args);
     remove_filter('posts_clauses', 'dt_core_join_left_filter');
     $g_arr = array();
     if (count($g_query->posts)) {
         foreach ($g_query->posts as $album) {
             if (post_password_required($album->ID)) {
                 continue;
             }
             $g_arr[] = $album->ID;
         }
     }
     dt_storage('where_filter_param', implode(', ', $g_arr));
     $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     add_filter('posts_where', 'dt_core_parents_where_filter');
     $p_query = new Wp_Query($args);
     remove_filter('posts_where', 'dt_core_parents_where_filter');
     $hs_slideshow_group = 'dt_widget_latphotos_' . intval($this->dt_hs_group);
     echo $before_widget;
     // start
     echo $before_title . $title . $after_title;
     echo '<div class="flickr" data-hs_group="' . $hs_slideshow_group . '">';
     if ($p_query->have_posts()) {
         foreach ($p_query->posts as $photo) {
             if (post_password_required($photo->post_parent)) {
                 continue;
             }
             $caption = $photo->post_excerpt;
             dt_get_thumb_img(array('img_meta' => wp_get_attachment_image_src($photo->ID, 'full'), 'class' => 'alignleft-f', 'title' => esc_attr($caption), 'alt' => get_post_meta($photo->ID, '_wp_attachment_image_alt', true), 'custom' => ' onclick="return hs.expand(this, { slideshowGroup: \'' . $hs_slideshow_group . '\' } )"', 'thumb_opts' => array('w' => 69, 'h' => 69)));
             /*				
                             if ( $caption && 0 )
                                 echo '<div class="highslide-caption">'.$caption.'</div>';
             */
         }
     }
     echo '</div><!-- /.flickr -->';
     echo $after_widget;
 }
Пример #2
0
function dt_blog_layput_init($layout)
{
    if ('dt-blog' != $layout) {
        return false;
    }
    global $post, $DT_QUERY;
    $opts = get_post_meta($post->ID, '_dt_meta_blog_options', true);
    $cats = get_post_meta($post->ID, '_dt_meta_blog_list', true);
    if (!($paged = get_query_var('page'))) {
        $paged = get_query_var('paged');
    }
    $args = array('post_type' => 'post', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'status' => 'publish', 'paged' => $paged);
    if ($opts['ppp']) {
        $args['posts_per_page'] = $opts['ppp'];
    }
    if (!isset($cats['blog_cats'])) {
        $cats['blog_cats'] = array();
    }
    switch ($cats['select']) {
        case 'only':
            $args['category__in'] = array_keys($cats['blog_cats']);
            break;
        case 'except':
            $args['category__not_in'] = array_keys($cats['blog_cats']);
    }
    $DT_QUERY = new WP_Query($args);
    if ($DT_QUERY->have_posts()) {
        $thumb_arr = dt_core_get_posts_thumbnails($DT_QUERY->posts);
        dt_storage('thumbs_array', $thumb_arr['thumbs_meta']);
    }
    dt_storage('post_is_first', 1);
}
Пример #3
0
function dt_search_portfolio_class_filter($class, $type = '', $place = '')
{
    if (isset($class['2_col']['list']['sidebar']['block']) && 'block' == $place) {
        $new_class = ' item-blog';
        if (1 === dt_storage('post_is_first')) {
            $new_class .= ' first';
            dt_storage('post_is_first', -1);
        }
        $class['2_col']['list']['sidebar']['block'] .= $new_class;
    }
    return $class;
}
Пример #4
0
function dt_shortcode_video($atts, $content = null)
{
    extract(shortcode_atts(array("column" => 'half'), $atts));
    $sizes_full = array('one-fourth' => array(209), 'three-fourth' => array(709), 'one-third' => array(291), 'two-thirds' => array(627), 'half' => array(459), 'full-width' => array(959));
    $sizes = array('one-fourth' => array(147), 'three-fourth' => array(523), 'one-third' => array(209), 'two-thirds' => array(459), 'half' => array(336), 'full-width' => array(711));
    $video_width = null;
    if (!dt_storage('have_sidebar') && isset($sizes_full[$column])) {
        $video_width = current($sizes_full[$column]);
    } elseif (dt_storage('have_sidebar') && isset($sizes[$column])) {
        $video_width = current($sizes[$column]);
    }
    return '<div class="' . esc_attr($column) . '"><div class="videos">' . dt_get_embed($content, $video_width, null, false) . '</div></div>';
}
Пример #5
0
function dt_core_parents_where_filter($where)
{
    if (function_exists('dt_storage')) {
        global $wpdb;
        $param = dt_storage('where_filter_param');
        dt_storage('where_filter_param', false);
        if ($param) {
            $where .= sprintf(" AND {$wpdb->posts}.post_parent IN(%s)", strip_tags($param));
        } else {
            $where .= ' AND 1=0';
        }
    }
    return $where;
}
Пример #6
0
function dt_woocommerce_before_main_content()
{
    dt_storage('have_sidebar', true);
    get_template_part('top-bg');
    ?>
	<div id="wrapper">
		
		<?php 
    get_template_part('nav');
    ?>
		
		<div id="container">
<?php 
}
Пример #7
0
function dt_print_widget_portfolio($atts)
{
    extract(shortcode_atts(array('title' => '', 'thumb_height' => '', 'order' => 'DESC', 'orderby' => 'date', 'ppp' => 6, 'lines' => 1, 'except' => '', 'only' => '', 'autoslide' => '', 'showdesc' => '1', 'column' => 'half'), $atts));
    $img_sizes_full = array('one-fourth' => array(210, 130), 'three-fourth' => array(223, 140), 'one-third' => array(290, 180), 'two-thirds' => array(303, 190), 'half' => array(219, 140), 'full-width' => array(225, 140));
    $img_sizes = array('one-fourth' => array(147, 90), 'three-fourth' => array(158, 100), 'one-third' => array(209, 130), 'two-thirds' => array(220, 140), 'half' => array(157, 100), 'full-width' => array(162, 100));
    $args = array('before_widget' => '<div class="' . esc_attr($column) . '">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', 'lines' => intval($lines));
    if (dt_storage('have_sidebar')) {
        if (isset($img_sizes[$column])) {
            $args['img_size'] = $img_sizes[$column];
        }
    } else {
        if (isset($img_sizes_full[$column])) {
            $args['img_size'] = $img_sizes_full[$column];
        }
    }
    $args['img_size_origin'] = array('305');
    $thumb_height = absint($thumb_height);
    if ($thumb_height && isset($args['img_size'])) {
        $args['img_size'][1] = $thumb_height;
    }
    $select = 'all';
    $cats = array();
    if ($except) {
        $select = 'except';
        $cats = array_map('trim', explode(',', $except));
    }
    if ($only) {
        $select = 'only';
        $cats = array_map('trim', explode(',', $only));
    }
    ob_start();
    $params = array("title" => $title, "show" => intval($ppp), "order" => strip_tags($order), "orderby" => strip_tags($orderby), "autoslide" => abs($autoslide * 1), "desc" => (bool) $showdesc, "select" => strip_tags($select));
    if ($cats) {
        $params['cats'] = $cats;
    }
    the_widget('DT_portfolio_Widget', $params, $args);
    $output = ob_get_clean();
    return $output;
}
Пример #8
0
function dt_team_layout_init($layout)
{
    if ('dt-team' != $layout) {
        return false;
    }
    global $post, $DT_QUERY;
    $defaults = array('content_position' => 'top', 'orderby' => 'date', 'order' => 'DESC', 'ppp' => '');
    $opts = get_post_meta($post->ID, '_dt_meta_team_options', true);
    $cats = get_post_meta($post->ID, '_dt_meta_team_list', true);
    $opts = wp_parse_args($opts, $defaults);
    if (!($paged = get_query_var('page'))) {
        $paged = get_query_var('paged');
    }
    $args = array('post_type' => 'dt_team', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'status' => 'publish', 'paged' => $paged);
    if ($opts['ppp']) {
        $args['posts_per_page'] = $opts['ppp'];
    }
    if (!isset($cats['team_cats'])) {
        $cats['team_cats'] = array();
        $cats['select'] = 'all';
    } else {
        $cats['team_cats'] = array_map('absint', array_values($cats['team_cats']));
    }
    if ('all' != $cats['select']) {
        $args['tax_query'] = array(array('taxonomy' => 'dt_team_category', 'field' => 'id', 'operator' => 'IN', 'terms' => $cats['team_cats']));
        if ('except' == $cats['select']) {
            $args['tax_query'][0]['operator'] = 'NOT IN';
        }
    }
    $DT_QUERY = new WP_Query($args);
    if ($DT_QUERY->have_posts()) {
        $thumb_arr = dt_core_get_posts_thumbnails($DT_QUERY->posts);
        dt_storage('thumbs_array', $thumb_arr['thumbs_meta']);
    }
    dt_storage('post_is_first', 1);
}
Пример #9
0
if ('only' == $sliders['select']) {
    $args['post__in'] = $sliders['slideshows'];
}
if ('except' == $sliders['select']) {
    $args['post__not_in'] = $sliders['slideshows'];
}
$sliders = new WP_Query($args);
$sliders_ids = array();
if ($sliders->have_posts()) {
    foreach ($sliders->posts as $slider) {
        $sliders_ids[] = $slider->ID;
    }
}
wp_reset_postdata();
$args = array('no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'order' => 'ASC', 'orderby' => 'menu_order', 'posts_per_page' => -1);
dt_storage('where_filter_param', implode(',', $sliders_ids));
add_filter('posts_where', 'dt_core_parents_where_filter');
$images = new WP_Query($args);
remove_filter('posts_where', 'dt_core_parents_where_filter');
$slides_arr = array();
global $current_user, $paged;
if ($images->have_posts() && ($paged >= 0 && $paged <= 1)) {
    $slide_hw = array('nivo' => array('w' => 960, 'h' => 400), 'carousel' => array('w' => 542, 'h' => 400), 'photo_stack' => array('w' => 239, 'h' => 399), 'fancy_tyle' => array('w' => 960, 'h' => 400));
    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 (!empty($post->post_excerpt) && !$hide_desc) {
            $tmp_arr['caption'] = get_the_excerpt();
Пример #10
0
?>

	<?php 
get_template_part('top-bg');
?>

	<?php 
get_template_part('nav');
?>
	
	<?php 
$slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
?>
	
	<?php 
if (dt_storage('is_homepage')) {
    if ('fullscreen_slider' == $slider_options['slider']) {
        $slider_section_id = 'fs-slideshow';
    } else {
        $slider_section_id = 'slide';
    }
    ?>
	<section id="<?php 
    echo $slider_section_id;
    ?>
"></section>
	<?php 
}
// if homepage
?>
	
Пример #11
0
function dt_ajax_paginator_filter($href)
{
    $data = dt_storage('page_data');
    $first = true;
    $data['cat_id'] = current($data['cat_id']);
    if (!$data['cat_id']) {
        $data['cat_id'] = 'all';
    }
    $search = array('&paged=', '?paged=', '/page/');
    foreach ($search as $exp) {
        $str = explode($exp, $href);
        if (isset($str[1])) {
            $href = '#' . $data['cat_id'] . '/' . $str[1];
            $first = false;
            break;
        }
    }
    if ($first) {
        $href = '#' . $data['cat_id'] . '/' . 1;
    }
    $href .= '/' . $data['layout'];
    if (!empty($data['base_url'])) {
        $href = str_replace(admin_url('admin-ajax.php'), $data['base_url'], $href);
    }
    return $href;
}
Пример #12
0
<?php

/* Template Name: 01. Page with Slideshow (Full-width) */
dt_storage('is_homepage', true);
do_action('dt_layout_before_header-slideshow');
get_header();
?>

    <?php 
get_template_part('top-bg');
?>

    <?php 
get_template_part('nav');
?>
	
	<?php 
$slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
?>
	
	<?php 
if ('fullscreen_slider' == $slider_options['slider']) {
    $slider_section_id = 'fs-slideshow';
} else {
    $slider_section_id = 'slide';
}
?>
	<section id="<?php 
echo $slider_section_id;
?>
"></section>	
Пример #13
0
echo get_search_query();
?>
</h1>
            <div class="hr hr-wide gap-big"></div>

            <?php 
do_action('dt_layout_before_loop', 'index');
if (have_posts()) {
    /* Add apropriet class to portfolio/gallery/category in search
     * Filter "dt_portfolio_default_classes" located in functions.php
     * Function defined in /modules/helpers/template-helper.php
     */
    add_filter('dt_portfolio_default_classes', 'dt_search_portfolio_class_filter', 10, 3);
    // some init stuff
    $add_data = array('init_layout' => '2_col-list', 'template_layout' => 'sidebar', 'thumb_w' => 344, 'thumb_h' => 220);
    dt_storage('add_data', $add_data);
    while (have_posts()) {
        the_post();
        if ('dt_gallery' == get_post_type()) {
            get_template_part('content', 'dt-albums');
            continue;
        }
        get_template_part('content', get_post_format());
    }
    if (function_exists('wp_pagenavi')) {
        wp_pagenavi();
    }
} else {
    echo '<p>' . __('Nothing found', LANGUAGE_ZONE) . '</p>';
}
?>
Пример #14
0
<?php

return;
$show = true;
$show_opt = of_get_option('mr_parallax-show');
if ('home' == $show_opt && !dt_storage('is_homepage') || 'ex_home' == $show_opt && dt_storage('is_homepage') || 'nowhere' == $show_opt) {
    $show = false;
}
if (of_get_option('mr_parallax-enable') && $show) {
    $parallax_lvls = array('first_level', 'second_level', 'third_level', 'forth_level');
    $animate = '';
    $anim_opt = of_get_option('mr_parallax-animate');
    if ('home' == $anim_opt && !dt_storage('is_homepage') || 'ex_home' == $anim_opt && dt_storage('is_homepage') || 'nowhere' == $anim_opt) {
        $animate = '{ xparallax: false, yparallax: false }';
    }
    ?>

    <script type="text/javascript">
        jQuery(document).ready( function() {
            initiate_parallax(<?php 
    echo $animate;
    ?>
);
        });
    </script>

<ul id="parallax">

<?php 
    foreach ($parallax_lvls as $lvl_name) {
        $style = sprintf('background-image: %s', dt_style_options_get_image(array(), of_get_option($lvl_name . '-bg_image', 'none'), of_get_option($lvl_name . '-bg_custom'), of_get_option($lvl_name . '-bg_upload')));
Пример #15
0
    _e('Archive: ', LANGUAGE_ZONE);
    if ($post) {
        echo get_post_format_string(get_post_format());
    } else {
        echo 'Standard';
    }
}
?>
</h1>

            <div class="hr hr-wide gap-big"></div>
			<!-- archive -->
            <?php 
do_action('dt_layout_before_loop', 'index');
global $wp_query;
dt_storage('post_is_first', 1);
if (have_posts()) {
    while (have_posts()) {
        the_post();
        get_template_part('content', get_post_format());
    }
    if (function_exists('wp_pagenavi')) {
        wp_pagenavi();
    }
}
?>

        </div>

        <?php 
get_sidebar();
Пример #16
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;
}
Пример #17
0
<?php

global $post;
$pg_opts = dt_storage('page_data');
$add_data = dt_storage('add_data');
?>
<div class="<?php 
dt_portfolio_classes($add_data['init_layout'], 'block');
?>
">

	<?php 
$caption = get_the_excerpt();
$caption_hs = '<div class="highslide-caption">';
$caption_hs .= $caption;
if (dt_is_page_soc_buttons_enabled('photo')) {
    $caption_hs .= dt_get_like_window(array('img' => urlencode(current(wp_get_attachment_image_src(get_the_ID(), 'thumbnail'))), 'full' => urlencode(current(wp_get_attachment_image_src(get_the_ID(), 'full'))), 'src' => urlencode(get_permalink(get_the_ID()))), false);
}
$caption_hs .= '</div>';
$img = dt_get_thumb_img(array('class' => 'photo highslide', 'alt' => get_post_meta($post->ID, '_wp_attachment_image_alt', true), 'img_meta' => wp_get_attachment_image_src($post->ID, 'full'), 'custom' => ' onclick="return hs.expand(this, galleryOptions)"', 'title' => strip_tags($caption), 'thumb_opts' => array('w' => $add_data['thumb_w'], 'h' => $add_data['thumb_h'])), '<div class="textwidget-photo"><a %HREF% %CLASS% %TITLE% %CUSTOM%><img %ALT% %SRC% %IMG_CLASS% %SIZE%/></a>' . $caption_hs . '</div>', false);
echo $img;
?>
</div>
Пример #18
0
function dt_password_form()
{
    global $post, $paged;
    $http_referer = wp_referer_field(false);
    $page_data = dt_storage('page_data');
    $wp_ver = explode('.', get_bloginfo('version'));
    $wp_ver = array_map('intval', $wp_ver);
    if ($wp_ver[0] < 3 || 3 == $wp_ver[0] && $wp_ver[1] <= 3) {
        $form_action = esc_url(get_option('siteurl') . '/wp-pass.php');
    } else {
        $form_action = esc_url(site_url('wp-login.php?action=postpass', 'login_post'));
    }
    if ($page_data && isset($page_data['base_url']) && isset($page_data['cat_id']) && isset($page_data['layout'])) {
        $site_url = site_url();
        $http_referer = str_replace(str_replace($site_url, '', admin_url('admin-ajax.php')), str_replace($site_url, '', $page_data['base_url']) . '#' . current($page_data['cat_id']) . '/' . $paged . '/' . $page_data['layout'], $http_referer);
    }
    $label = 'pwbox-' . (empty($post->ID) ? rand() : $post->ID);
    $o = '<div class="form-protect"><form class="protected-post-form get-in-touch" action="' . $form_action . '" method="post">' . $http_referer . '
    <div>' . __("To view this protected post, enter the password below:", LANGUAGE_ZONE) . '</div>
    <label for="' . $label . '">' . __("Password:"******"i-h"><input name="post_password" id="' . $label . '" type="password" size="20" /></div>
	<div class="but-wrap"><a class="button go_submit" onClick="submit();" href="#"><span>' . esc_attr__("Submit", LANGUAGE_ZONE) . '</span></a></div>
    </form></div>
    ';
    return $o;
}
Пример #19
0
<?php

global $post;
$template = dt_core_get_template_name();
?>

<style type="text/css">

	<?php 
$po = array();
if (!empty($post) && !dt_storage('is_index') && !is_archive()) {
    $po = get_post_meta($post->ID, '_dt_background_options', true);
}
$bg_fixed = false;
if (empty($po['enable'])) {
    $main_bg_img = dt_style_options_get_image(array(), of_get_option('background-bg_image', 'none'), of_get_option('main_bg-bg_custom'), of_get_option('main_bg-bg_upload'));
    $main_bg_pos = dt_style_options_get_bg_position(of_get_option('main_bg-bg_horizontal_pos'), of_get_option('main_bg-bg_vertical_pos'));
    $main_bg_color = of_get_option('main_bg-bg_color');
    $bg_repeat = of_get_option('main_bg-bg_repeat');
} else {
    if (!empty($po['bg_image'])) {
        $main_bg_img = 'url("' . $po['bg_image'] . '")';
    } else {
        $main_bg_img = 'none';
    }
    $main_bg_img .= ' !important;';
    $main_bg_pos = dt_style_options_get_bg_position(isset($po['h_pos']) ? $po['h_pos'] : 'center', isset($po['v_pos']) ? $po['v_pos'] : 'center');
    $main_bg_color = !empty($po['color']) ? $po['color'] : '#000';
    $bg_repeat = isset($po['repeat']) ? $po['repeat'] : 'repeat';
    if (!empty($po['fixed'])) {
        $bg_fixed = true;
Пример #20
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;
}
Пример #21
0
    function widget($args, $instance)
    {
        static $hs_group = 0;
        $hs_group++;
        extract($args);
        $instance = wp_parse_args((array) $instance, $this->dt_defaults);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $autoslide = $instance['autoslide'];
        $autoslide_on = $autoslide ? 1 : 0;
        $h = 130;
        if ($instance['thumb_height']) {
            $h = $instance['thumb_height'];
        }
        $args = array('no_found_rows' => 1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats'])));
        switch ($instance['select']) {
            case 'only':
                $args['tax_query'][0]['operator'] = 'IN';
                break;
            case 'except':
                $args['tax_query'][0]['operator'] = 'NOT IN';
                break;
            default:
                unset($args['tax_query']);
        }
        add_filter('posts_where', 'dt_exclude_post_protected_filter');
        add_filter('posts_clauses', 'dt_core_join_left_filter');
        $p_query = new WP_Query($args);
        remove_filter('posts_clauses', 'dt_core_join_left_filter');
        remove_filter('posts_where', 'dt_exclude_post_protected_filter');
        $output = array();
        if ($p_query->have_posts()) {
            foreach ($p_query->posts as $album) {
                $output[] = $album->ID;
            }
        }
        dt_storage('where_filter_param', implode(',', $output));
        $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'posts_per_page' => $instance['show']);
        add_filter('posts_where', 'dt_core_parents_where_filter');
        $p_query->query($args);
        remove_filter('posts_where', 'dt_core_parents_where_filter');
        echo $before_widget;
        // start
        echo $before_title . $title . $after_title;
        ?>

		<div class="list-carousel recent bx">
			<ul class="sliderBx" data-autoslide="<?php 
        echo $autoslide;
        ?>
" data-autoslide_on="<?php 
        echo $autoslide_on;
        ?>
">

		<?php 
        if ($p_query->have_posts()) {
            $class = ' first';
            foreach ($p_query->posts as $photo) {
                ?>
				<li>
					<div class="textwidget<?php 
                echo $class;
                ?>
">
						<div class="textwidget-photo">
							<?php 
                $caption = $photo->post_excerpt;
                dt_get_thumb_img(array('img_meta' => wp_get_attachment_image_src($photo->ID, 'full'), 'class' => 'photo highslide', 'title' => esc_attr($caption), 'alt' => get_post_meta($photo->ID, '_wp_attachment_image_alt', true), 'custom' => ' onclick="return hs.expand(this, { slideshowGroup: \'dt_widget_photos_' . intval($hs_group) . '\' } )"', 'thumb_opts' => array('w' => 210, 'h' => $h)));
                $class = '';
                ?>
						</div>

					</div>
				</li>
			<?php 
            }
        }
        ?>

			</ul> 

		</div>

		<?php 
        echo $after_widget;
    }
Пример #22
0
$vid_opts = get_post_meta(get_the_ID(), '_dt_video_options', true);
$w_str = $h_str = '';
$custom = ' onclick="return false;"';
if (!empty($vid_opts['video_link']) && !post_password_required()) {
    $video_html = dt_get_embed($vid_opts['video_link'], $vid_opts['width'] ? $vid_opts['width'] : null, $vid_opts['height'] ? $vid_opts['height'] : null, false);
    preg_match('/width=[\\"\'\\s](\\d+?)[\\"\'\\s]/', $video_html, $width);
    preg_match('/height=[\\"\'\\s](\\d+?)[\\"\'\\s]/', $video_html, $height);
    if (isset($width[1])) {
        $w_str = ", width: " . intval($width[1]);
    }
    if (isset($height[1])) {
        $h_str = ", height: " . intval($height[1] + 5);
    }
    $custom = ' onclick="return hs.htmlExpand(this, { captionEval: null, contentId: \'dt-content-id-' . get_the_ID() . '\'' . $w_str . $h_str . ' });"';
}
$page_data = dt_storage('page_data');
if ($page_data && isset($page_data['page_options'])) {
    $page_opts = $page_data['page_options'];
} else {
    $page_opts = array();
}
// pass protected
$pass_form = '';
$img_custom = ' onclick="jQuery(this).parents(\'.dt-hs-container\').find(\'.textwidget-photo:first a.photo\').click(); return false;"';
if (post_password_required()) {
    $pass_form = get_the_password_form();
    $title_tag = '<h3><span class="%s">%s</span></h3>';
} else {
    $title_tag = '<h3><a class="%s" href="#"' . $img_custom . '>%s</a></h3>';
}
$title = sprintf($title_tag, dt_portfolio_classes($add_data['init_layout'], 'head', false), get_the_title());
Пример #23
0
function dt_photos_layout_init($layout, $data = array())
{
    if ('dt-photos' != $layout || !isset($data['cat_id'])) {
        return false;
    }
    global $post, $DT_QUERY, $wpdb;
    $opts = get_post_meta($post->ID, '_dt_photos_layout_options', true);
    $cats = get_post_meta($post->ID, '_dt_photos_layout_albums', true);
    $page_data = dt_storage('page_data');
    if ($page_data && is_array($page_data)) {
        $page_data['page_options'] = $opts;
        dt_storage('page_data', $page_data);
    } else {
        dt_storage('page_data', array('page_options' => $opts));
    }
    dt_storage_add_data_init(array('layout' => $opts['layout']));
    if (!($paged = get_query_var('page'))) {
        $paged = get_query_var('paged');
    }
    $args = array('post_type' => 'dt_gallery', 'post_status' => 'publish');
    $args['posts_per_page'] = -1;
    if (!isset($cats['albums_cats'])) {
        $cats['albums_cats'] = array();
    } else {
        $cats['albums_cats'] = array_map('intval', array_values($cats['albums_cats']));
    }
    if (is_array($data['cat_id'])) {
        $args['tax_query'] = array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'operator' => 'IN'));
        $args['tax_query'][0]['terms'] = intval(current($data['cat_id']));
        if ('category' == $cats['type'] && !empty($cats['albums_cats']) && 'all' != $cats['select']) {
            $in_array = in_array(current($data['cat_id']), $cats['albums_cats']);
            if ('only' == $cats['select'] && !$in_array || 'except' == $cats['select'] && $in_array) {
                $args['tax_query'][0]['terms'] = 0;
            }
        }
    } elseif ('none' == $data['cat_id']) {
        $terms = get_terms('dt_gallery_category', array('type' => 'dt_gallery', 'hide_empty' => 1, 'hierarchical' => 0, 'pad_counts' => false, 'fields' => 'ids'));
        $args['tax_query'] = array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $terms, 'operator' => 'NOT IN'));
    } elseif ('category' == $cats['type'] && !empty($cats['albums_cats']) && 'all' != $cats['select']) {
        $args['tax_query'] = array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $cats['albums_cats']));
        switch ($cats['select']) {
            case 'only':
                $args['tax_query'][0]['operator'] = 'IN';
                break;
            case 'except':
                $terms = get_terms('dt_gallery_category', array('type' => 'dt_gallery', 'hide_empty' => 1, 'hierarchical' => 0, 'pad_counts' => false, 'fields' => 'ids'));
                $args['tax_query'][0]['operator'] = 'IN';
                $terms_arr = array_diff($terms, $cats['albums_cats']);
                sort($terms_arr);
                $args['tax_query']['relation'] = 'OR';
                $args['tax_query'][1] = $args['tax_query'][0];
                $args['tax_query'][0]['terms'] = $terms_arr;
                $args['tax_query'][1]['operator'] = 'NOT IN';
                if (empty($terms_arr)) {
                    $args['tax_query'][0] = $args['tax_query'][1];
                    unset($args['tax_query'][1], $args['tax_query']['relation']);
                }
        }
    }
    if ('albums' == $cats['type'] && !empty($cats['albums']) && 'all' != $cats['select']) {
        switch ($cats['select']) {
            case 'only':
                $args['post__in'] = array_values($cats['albums']);
                break;
            case 'except':
                $args['post__not_in'] = array_values($cats['albums']);
        }
    }
    add_filter('posts_clauses', 'dt_core_join_left_filter');
    $DT_QUERY = new WP_Query($args);
    remove_filter('posts_clauses', 'dt_core_join_left_filter');
    if ($DT_QUERY->have_posts()) {
        foreach ($DT_QUERY->posts as $album) {
            if (post_password_required($album->ID)) {
                continue;
            }
            $output[] = $album->ID;
        }
    } else {
        return;
    }
    dt_storage('where_filter_param', implode(',', $output));
    $args = array('post_type' => 'attachment', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'post_mime_type' => 'image', 'post_status' => 'inherit', 'paged' => $paged);
    if ($opts['ppp']) {
        $args['posts_per_page'] = $opts['ppp'];
    }
    add_filter('posts_where', 'dt_core_parents_where_filter');
    $DT_QUERY->query($args);
    remove_filter('posts_where', 'dt_core_parents_where_filter');
    dt_storage('num_pages', 'on' == $opts['show_all_pages'] ? 999 : null);
}
Пример #24
0
        }
        if (!empty($page_opts['fs_hide_footer'])) {
            $body_class[] = 'fs-no-footer';
        }
    }
}
wp_head();
?>
</head>
<body <?php 
body_class($body_class);
?>
>
<?php 
$class = array();
if (dt_storage('is_homepage') && !dt_storage('have_obo_slider') && !dt_storage('is_blog')) {
    $slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
    if ($slider_options && isset($slider_options['slider'])) {
        switch ($slider_options['slider']) {
            case 'carousel':
                $class[] = 'carous';
                break;
            case 'photo_stack':
                $class[] = 'vert';
        }
    }
}
$class = implode(' ', $class);
if (!empty($class)) {
    $class = ' class="' . $class . '"';
}
Пример #25
0
    function widget($args, $instance)
    {
        global $post;
        static $hs_group = 0;
        $hs_group++;
        extract($args);
        $instance = wp_parse_args((array) $instance, $this->dt_defaults);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $autoslide = $instance['autoslide'];
        $autoslide_on = $autoslide ? 1 : 0;
        $h = 130;
        if ($instance['thumb_height']) {
            $h = $instance['thumb_height'];
        }
        $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats'])));
        switch ($instance['select']) {
            case 'only':
                $args['tax_query'][0]['operator'] = 'IN';
                break;
            case 'except':
                $args['tax_query'][0]['operator'] = 'NOT IN';
                break;
            default:
                unset($args['tax_query']);
        }
        add_filter('posts_where', 'dt_exclude_post_protected_filter');
        add_filter('posts_clauses', 'dt_core_join_left_filter');
        $p_query = new WP_Query($args);
        remove_filter('posts_clauses', 'dt_core_join_left_filter');
        remove_filter('posts_where', 'dt_exclude_post_protected_filter');
        // caching!
        if ($p_query->have_posts()) {
            $gals_ids = array();
            foreach ($p_query->posts as $gal) {
                $gals_ids[] = $gal->ID;
            }
            $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'orderby' => 'menu_order');
            dt_storage('where_filter_param', implode(',', $gals_ids));
            add_filter('posts_where', 'dt_core_parents_where_filter');
            $i_query = new WP_Query($args);
            remove_filter('posts_where', 'dt_core_parents_where_filter');
            $cached_images = array();
            if ($i_query->have_posts()) {
                foreach ($i_query->posts as $cached_image) {
                    if (!isset($cached_images[$cached_image->post_parent])) {
                        $cached_images[$cached_image->post_parent] = array();
                    }
                    $cached_images[$cached_image->post_parent][$cached_image->ID] = $cached_image;
                }
            }
        }
        echo $before_widget;
        // start
        echo $before_title . $title . $after_title;
        ?>
	
        
        <div class="list-carousel recent bx">
            <ul class="sliderBx" data-autoslide="<?php 
        echo $autoslide;
        ?>
" data-autoslide_on="<?php 
        echo $autoslide_on;
        ?>
">
        
				<?php 
        if ($p_query->have_posts()) {
            $class = ' first';
            $hs_class = ' highslide';
            $group = 1;
            while ($p_query->have_posts()) {
                $p_query->the_post();
                $thumb_id = get_post_thumbnail_id();
                $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => 'inherit');
                $images = new WP_Query($args);
                if (has_post_thumbnail(get_the_ID())) {
                    $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full');
                } elseif ($images->have_posts()) {
                    $thumb_meta = wp_get_attachment_image_src($images->posts[0]->ID, 'full');
                } else {
                    $thumb_meta = null;
                }
                ?>
						<li>
							<div class="textwidget<?php 
                echo $class;
                ?>
">
								<?php 
                $main_img_alt = get_post_meta(get_the_ID(), '_wp_attachment_image_alt', true);
                dt_get_thumb_img(array('class' => 'photo' . ($instance['desc'] ? '' : $hs_class), 'img_meta' => $thumb_meta, 'title' => get_the_title(), 'custom' => '', 'use_noimage' => true, 'thumb_opts' => array('w' => 210, 'h' => $h)), '<div class="textwidget-photo"><a %HREF% %CLASS% %TITLE% %CUSTOM%><img alt="' . esc_attr($main_img_alt) . '" %SRC% %SIZE% /></a></div>');
                $class = '';
                if ($images->have_posts()) {
                    ?>
				
									<div class="hidden-container" data-hs_group="dt_widget_gallery_<?php 
                    echo $hs_group . '_' . $group;
                    ?>
">

										<?php 
                    foreach ($images->posts as $image) {
                        $alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true);
                        dt_get_thumb_img(array('class' => 'highslide', 'title' => strip_tags($image->post_excerpt), 'img_meta' => wp_get_attachment_image_src($image->ID, 'full'), 'thumb_opts' => array('w' => 90, 'h' => 90)), '<a %HREF% %CLASS% %CUSTOM% %TITLE% ><img alt="' . esc_attr($alt) . '" %SRC% %SIZE%/></a>');
                    }
                    ?>
					
									</div>
								
								<?php 
                }
                ?>
								
								<?php 
                if ($instance['desc']) {
                    ?>

									<div class="widget-info">    
										<h3><a href="<?php 
                    echo get_permalink();
                    ?>
" class="head"><?php 
                    echo get_the_title();
                    ?>
</a></h3>
										<p><?php 
                    echo strip_tags(get_the_excerpt());
                    ?>
</p>
									</div>
								
								<?php 
                }
                ?>

							</div>    
						</li>
						<?php 
                $group++;
            }
            wp_reset_postdata();
        }
        ?>

            </ul> 

        </div>
	    
        <?php 
        echo $after_widget;
    }
Пример #26
0
<?php

dt_storage('have_sidebar', true);
?>

<?php 
get_header();
?>
    
    <?php 
get_template_part('top-bg');
?>
    
    <?php 
get_template_part('parallax');
?>
    
    <div id="wrapper">
        
        <?php 
get_template_part('nav');
?>
        
        <div id="container">
            
            <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
            
Пример #27
0
function dt_portfolio_layout_init($layout, $data = array())
{
    if ('dt-portfolio' != $layout || !isset($data['cat_id'])) {
        return false;
    }
    global $post, $DT_QUERY;
    $opts = get_post_meta($post->ID, '_dt_portfolio_layout_options', true);
    $cats = get_post_meta($post->ID, '_dt_portfolio_layout_category', true);
    $page_data = dt_storage('page_data');
    if ($page_data && is_array($page_data)) {
        $page_data['page_options'] = $opts;
        dt_storage('page_data', $page_data);
    } else {
        dt_storage('page_data', array('page_options' => $opts));
    }
    dt_storage_add_data_init(array('layout' => $opts['layout']));
    if (!($paged = get_query_var('page'))) {
        $paged = get_query_var('paged');
    }
    $args = array('post_type' => 'dt_portfolio', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'status' => 'publish', 'paged' => $paged);
    if ($opts['ppp']) {
        $args['posts_per_page'] = $opts['ppp'];
    }
    if (!isset($cats['portfolio_cats'])) {
        $cats['portfolio_cats'] = array();
    } else {
        $cats['portfolio_cats'] = array_map('intval', array_values($cats['portfolio_cats']));
    }
    if (is_array($data['cat_id'])) {
        $in_array = in_array(current($data['cat_id']), $cats['portfolio_cats']);
        $args['tax_query'] = array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'id', 'operator' => 'IN'));
        if ('only' == $cats['select'] && $in_array || 'except' == $cats['select'] && !$in_array || 'all' == $cats['select']) {
            $args['tax_query'][0]['terms'] = intval(current($data['cat_id']));
        } else {
            $args['tax_query'][0]['terms'] = 0;
        }
    } elseif ('none' == $data['cat_id'] || !empty($cats['portfolio_cats']) && !('all' == $cats['select'])) {
        $terms = get_terms('dt_portfolio_category', array('type' => 'dt_portfolio', 'hide_empty' => 1, 'hierarchical' => 0, 'pad_counts' => false, 'fields' => 'ids'));
        $args['tax_query'] = array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'id', 'terms' => $terms, 'operator' => 'IN'));
        if ('none' == $data['cat_id']) {
            $args['tax_query'][0]['operator'] = 'NOT IN';
        } elseif ('except' == $cats['select']) {
            $terms_arr = array_diff($terms, $cats['portfolio_cats']);
            sort($terms_arr);
            $args['tax_query']['relation'] = 'OR';
            $args['tax_query'][1] = $args['tax_query'][0];
            $args['tax_query'][0]['terms'] = $terms_arr;
            $args['tax_query'][1]['operator'] = 'NOT IN';
            if (empty($terms_arr)) {
                $args['tax_query'][0] = $args['tax_query'][1];
                unset($args['tax_query'][1], $args['tax_query']['relation']);
            }
        } elseif ('only' == $cats['select']) {
            $args['tax_query'][0]['terms'] = $cats['portfolio_cats'];
        }
    }
    add_filter('posts_clauses', 'dt_core_join_left_filter');
    $DT_QUERY = new WP_Query($args);
    remove_filter('posts_clauses', 'dt_core_join_left_filter');
    if ($DT_QUERY->have_posts()) {
        $thumb_arr = dt_core_get_posts_thumbnails($DT_QUERY->posts);
        dt_storage('thumbs_array', $thumb_arr['thumbs_meta']);
    }
    dt_storage('post_is_first', 1);
    dt_storage('num_pages', 'on' == $opts['show_all_pages'] ? 999 : null);
}
Пример #28
0
dt_get_comments_link($comments, array('no_coments' => ''));
?>

    </div>
    
<?php 
if (!post_password_required($post->ID)) {
    // thumbnail
    if (has_post_thumbnail()) {
        $img_id = get_post_thumbnail_id();
        // get alt
        $img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true);
        if (!$img_alt) {
            $img_alt = get_the_title();
        }
        $t_w = 710;
        $thumb_args = array('alt' => $img_alt, 'class' => 'alignleft text img-posts', 'href' => get_permalink(), 'img_meta' => dt_get_thumb_meta(dt_storage('thumbs_array')));
        if ($thumb_args['img_meta'][1] > $t_w) {
            $thumb_args['thumb_opts'] = array('w' => $t_w);
        }
        dt_get_thumb_img($thumb_args);
    }
    dt_the_content();
    dt_details_link();
    dt_edit_link();
} else {
    echo get_the_password_form();
}
?>

</div>
Пример #29
0
<?php

/* Template Name: 16. OneByOne Slider (Full-width) */
dt_storage('is_homepage', true);
dt_storage('have_obo_slider', true);
do_action('dt_layout_before_header-oboslider');
get_header();
?>

    <?php 
get_template_part('top-bg');
?>

    <?php 
get_template_part('nav');
?>

	<section id="slide" class="byOne" style="height: ;"></section>
	
	<div id="container" class="full-width"><?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        the_content();
    }
}
?>
</div>

<?php 
get_footer();
Пример #30
0
<?php

dt_storage('have_sidebar', true);
dt_storage('is_index', true);
get_header();
?>
    
    <?php 
get_template_part('top-bg');
?>
    
    <div id="wrapper">
        
        <?php 
get_template_part('nav');
?>
        
        <div id="container"<?php 
echo dt_get_container_class();
?>
>
            <h1><?php 
_e('Blog', LANGUAGE_ZONE);
?>
</h1>
            <div class="hr hr-wide gap-big"></div>

            <?php 
do_action('dt_layout_before_loop', 'index');
if (have_posts()) {
    while (have_posts()) {