protected function do_pagination($query)
 {
     if (is_wp_error($query)) {
         return;
     }
     $paged = dt_get_paged_var();
     $this->response['nextPage'] = dt_get_next_posts_url($query->max_num_pages) ? $paged + 1 : 0;
     $load_style = $this->config->get('load_style');
     if (presscore_is_load_more_pagination()) {
         $pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
         if ($pagination) {
             $this->response['currentPage'] = $paged;
             $this->response['paginationHtml'] = $pagination;
         } else {
             $this->response['currentPage'] = $this->input['post_paged'];
         }
         $this->response['paginationType'] = 'more';
     } else {
         if ('ajax_pagination' == $load_style) {
             ob_start();
             dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
             $pagination = ob_get_clean();
             if ($pagination) {
                 $this->response['paginationHtml'] = $pagination;
             }
             $this->response['paginationType'] = 'paginator';
         }
     }
 }
 public function get_posts_by_terms($args = array())
 {
     $defaults = array('post_type' => 'post', 'taxonomy' => 'category', 'terms' => null, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => 10, 'post__in' => null, 'post__not_in' => null, 'select' => 'all', 'no_found_rows' => false);
     $args = wp_parse_args($args, $defaults);
     if (!$this->verify_args($args)) {
         return new WP_Query();
     }
     $query_args = array('post_type' => $args['post_type'], 'order' => $args['order'], 'no_found_rows' => $args['no_found_rows'], 'orderby' => 'name' == $args['orderby'] ? 'title' : $args['orderby'], 'paged' => dt_get_paged_var(), 'post_status' => 'publish');
     if ($args['posts_per_page']) {
         $query_args['posts_per_page'] = $args['posts_per_page'];
     }
     if ($args['post__in']) {
         $query_args['post__in'] = $args['post__in'];
     }
     if ($args['post__not_in']) {
         $query_args['post__not_in'] = $args['post__not_in'];
     }
     // construct base tax_query if not all terms slected
     if (in_array($args['select'], array('only', 'except')) && !empty($args['terms']) && is_array($args['terms'])) {
         // get all terms ids
         $all_terms = wp_list_pluck(get_categories(array('type' => $args['post_type'], 'taxonomy' => $args['taxonomy'], 'pad_counts' => false, 'hide_empty' => 1, 'hierarchical' => 0)), 'term_id');
         // sanitize terms
         $terms = array_values($args['terms']);
         // ONLY tax_query
         if ('only' == $args['select']) {
             $operator = 'IN';
             if (0 == $terms[0]) {
                 $terms = $all_terms;
                 $operator = 'NOT IN';
             }
             $query_args['tax_query'] = array(array('taxonomy' => $args['taxonomy'], 'terms' => $terms, 'operator' => $operator, 'field' => 'id'));
             // EXCEPT tax_query
         } else {
             if ('except' == $args['select']) {
                 $in_terms = array_diff($all_terms, $terms);
                 sort($in_terms);
                 if ($in_terms) {
                     $query_args['tax_query'] = array('relation' => 'OR', array('taxonomy' => $args['taxonomy'], 'terms' => $in_terms, 'operator' => 'IN', 'field' => 'id'), array('taxonomy' => $args['taxonomy'], 'terms' => $terms, 'operator' => 'NOT IN', 'field' => 'id'));
                     add_filter('posts_clauses', 'dt_core_join_left_filter');
                 }
             }
         }
     }
     $page_query = new WP_Query($query_args);
     remove_filter('posts_clauses', 'dt_core_join_left_filter');
     return $page_query;
 }
 /**
  * @return WP_Query Album photos query.
  */
 function presscore_mod_albums_get_photos()
 {
     $albums_query = presscore_get_filtered_posts(array('post_type' => 'dt_gallery', 'taxonomy' => 'dt_gallery_category', 'posts_per_page' => -1));
     $media_items = array(0);
     if ($albums_query->have_posts()) {
         $media_items = array();
         foreach ($albums_query->posts as $gallery) {
             $gallery_media = get_post_meta($gallery->ID, '_dt_album_media_items', true);
             if (is_array($gallery_media)) {
                 $media_items = array_merge($media_items, $gallery_media);
             }
         }
     }
     $media_items = array_unique($media_items);
     $attachments_args = array('post__in' => $media_items, 'orderby' => 'post__in', 'no_found_rows' => false, 'paged' => dt_get_paged_var());
     $posts_per_page = presscore_config()->get('posts_per_page');
     if ($posts_per_page) {
         $attachments_args['posts_per_page'] = $posts_per_page;
     }
     return presscore_query()->get_attachments($attachments_args);
 }
Exemplo n.º 4
0
 /**
  * [presscore_masonry_container_data_atts description]
  *
  * @since 1.0.0
  * 
  * @return satring [description]
  */
 function presscore_masonry_container_data_atts()
 {
     $config = Presscore_Config::get_instance();
     $data_atts = array('data-padding="' . intval($config->get('item_padding')) . 'px"', 'data-cur-page="' . dt_get_paged_var() . '"');
     if ($config->get('hide_last_row')) {
         $data_atts[] = 'data-part-row="false"';
     }
     $target_height = $config->get('target_height');
     if (null !== $target_height) {
         $data_atts[] = 'data-target-height="' . absint($target_height) . 'px"';
     }
     $target_width = $config->get('post.preview.width.min');
     if (null !== $target_width) {
         $data_atts[] = 'data-width="' . absint($target_width) . 'px"';
     }
     $columns = $config->get('template.columns.number');
     if (null !== $columns) {
         $data_atts[] = 'data-columns="' . absint($columns) . '"';
     }
     return ' ' . implode(' ', $data_atts);
 }
Exemplo n.º 5
0
					<?php 
            if (!post_password_required()) {
                ?>

					<?php 
                $ppp = $config->get('posts_per_page');
                $order = $config->get('order');
                $orderby = $config->get('orderby');
                $display = $config->get('display');
                $request_display = $config->get('request_display');
                $all_terms = get_categories(array('type' => 'dt_portfolio', 'hide_empty' => 1, 'hierarchical' => 0, 'taxonomy' => 'dt_portfolio_category', 'pad_counts' => false));
                $all_terms_array = array();
                foreach ($all_terms as $term) {
                    $all_terms_array[] = $term->term_id;
                }
                $page_args = array('post_type' => 'dt_portfolio', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $order, 'orderby' => $orderby);
                if ($ppp) {
                    $page_args['posts_per_page'] = intval($ppp);
                }
                if ('all' != $display['select'] && !empty($display['terms_ids'])) {
                    $page_args['tax_query'] = array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'term_id', 'terms' => array_values($display['terms_ids']), 'operator' => 'IN'));
                    if ('except' == $display['select']) {
                        $terms_arr = array_diff($all_terms_array, $display['terms_ids']);
                        sort($terms_arr);
                        if ($terms_arr) {
                            $page_args['tax_query']['relation'] = 'OR';
                            $page_args['tax_query'][1] = $page_args['tax_query'][0];
                            $page_args['tax_query'][0]['terms'] = $terms_arr;
                            $page_args['tax_query'][1]['operator'] = 'NOT IN';
                        }
                        add_filter('posts_clauses', 'dt_core_join_left_filter');
Exemplo n.º 6
0
    /**
     * Next page button.
     *
     */
    function dt_get_next_page_button($max, $class = '')
    {
        $next_posts_link = dt_get_next_posts_url($max);
        if ($next_posts_link) {
            $icon = '<svg class="loading-icon" viewBox="0 0 48 48" ><path d="M23.98,0.04c-13.055,0-23.673,10.434-23.973,23.417C0.284,12.128,8.898,3.038,19.484,3.038c10.76,0,19.484,9.395,19.484,20.982c0,2.483,2.013,4.497,4.496,4.497c2.482,0,4.496-2.014,4.496-4.497C47.96,10.776,37.224,0.04,23.98,0.04z M23.98,48c13.055,0,23.673-10.434,23.972-23.417c-0.276,11.328-8.89,20.42-19.476,20.42	c-10.76,0-19.484-9.396-19.484-20.983c0-2.482-2.014-4.496-4.497-4.496C2.014,19.524,0,21.537,0,24.02C0,37.264,10.736,48,23.98,48z"/></svg>';
            return '<div class="' . esc_attr($class) . '">
				<a class="button-load-more" href="javascript: void(0);" data-dt-page="' . dt_get_paged_var() . '" >' . $icon . '<span class="button-caption">' . __('Load more', LANGUAGE_ZONE) . '</span></a>
			</div>';
        }
        return '';
    }
Exemplo n.º 7
0
                    case 'on_dark_gradient':
                        $masonry_container_classes[] = 'hover-style-one';
                        if ('always' == $config->get('hover_content_visibility')) {
                            $masonry_container_classes[] = 'always-show-info';
                        }
                        break;
                    case 'from_bottom':
                        $masonry_container_classes[] = 'hover-style-three';
                        $masonry_container_classes[] = 'cs-style-3';
                        if ('always' == $config->get('hover_content_visibility')) {
                            $masonry_container_classes[] = 'always-show-info';
                        }
                        break;
                }
                $masonry_container_classes = implode(' ', $masonry_container_classes);
                $masonry_container_data_attr = array('data-padding="' . intval($item_padding) . 'px"', 'data-target-height="' . intval($target_height) . 'px"', 'data-cur-page="' . dt_get_paged_var() . '"');
                if ($config->get('hide_last_row')) {
                    $masonry_container_data_attr[] = 'data-part-row="false"';
                }
                // ninjaaaa!
                $masonry_container_data_attr = ' ' . implode(' ', $masonry_container_data_attr);
                ?>

						<?php 
                if ($full_width) {
                    ?>

					<div class="full-width-wrap">

						<?php 
                }
    /**
     * Next page button.
     *
     */
    function dt_get_next_page_button($max, $class = '')
    {
        $next_posts_link = dt_get_next_posts_url($max);
        if ($next_posts_link) {
            $button_html_class = 'button-load-more';
            if (presscore_is_lazy_loading()) {
                $button_html_class .= ' button-lazy-loading';
                $caption = __('Loading...', 'the7mk2');
            } else {
                $caption = __('Load more', 'the7mk2');
            }
            $caption = apply_filters('dt_get_next_page_button-caption', $caption);
            $icon = '<span class="stick"></span><span class="stick"></span><span class="stick"></span>';
            return '<div class="' . esc_attr($class) . '">
				<a class="' . $button_html_class . '" href="javascript: void(0);" data-dt-page="' . dt_get_paged_var() . '" >' . $icon . '<span class="h5-size button-caption">' . $caption . '</span></a>
			</div>';
        }
        return '';
    }
Exemplo n.º 9
0
<?php

/* Template Name: 15. Homepage with Blog */
dt_storage('is_homepage', dt_get_paged_var() <= 1);
dt_storage('is_blog', true);
dt_storage('have_sidebar', true);
do_action('dt_layout_before_header-blog');
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 (dt_storage('is_homepage')) {
    if ('fullscreen_slider' == $slider_options['slider']) {
        $slider_section_id = 'fs-slideshow';
    } else {
        $slider_section_id = 'slide';
    }
    ?>
	<section id="<?php 
Exemplo n.º 10
0
            ?>

					<?php 
            do_action('presscore_before_loop');
            ?>

					<?php 
            $full_width = $config->get('full_width');
            $item_padding = $config->get('item_padding');
            $target_width = $config->get('target_width');
            $ppp = $config->get('posts_per_page');
            $order = $config->get('order');
            $orderby = $config->get('orderby');
            $display = $config->get('display');
            $layout = $config->get('layout');
            $blog_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $order, 'orderby' => 'name' == $orderby ? 'title' : $orderby);
            if ($ppp) {
                $blog_args['posts_per_page'] = intval($ppp);
            }
            if (!empty($display['terms_ids'])) {
                $terms_ids = array_values($display['terms_ids']);
                switch ($display['select']) {
                    case 'only':
                        $blog_args['category__in'] = $terms_ids;
                        break;
                    case 'except':
                        $blog_args['category__not_in'] = $terms_ids;
                }
            }
            $blog_query = new WP_Query($blog_args);
            // masonry layout
Exemplo n.º 11
0
	/**
	 * Add theme speciffik classes to body.
	 *
	 * @since presscore 1.0
	 */
	function presscore_body_class( $classes ) {
		global $post;
		$config = Presscore_Config::get_instance();

		$desc_on_hoover = ( 'under_image' != $config->get('description') );
		$template = $config->get('template');
		$layout = $config->get('layout');

		// template classes
		switch ( $template ) {
			case 'blog':
				$classes[] = 'blog';

				if ( !of_get_option( 'general-blog_meta_postformat', 1 ) ) {
					$classes[] = 'post-format-icons-disabled';
				}

				break;
			case 'portfolio': $classes[] = 'portfolio'; break;
			case 'team': $classes[] = 'team'; break;
			case 'testimonials': $classes[] = 'testimonials'; break;
			case 'archive': $classes[] = 'archive'; break;
			case 'search': $classes[] = 'search'; break;
			case 'albums': $classes[] = 'albums'; break;
			case 'media': $classes[] = 'media'; break;
			case 'microsite': $classes[] = 'one-page-row'; break;
		}

		// layout classes
		switch ( $layout ) {
			case 'masonry':
				if ( $desc_on_hoover ) {
					$classes[] = 'layout-masonry-grid';
				} else {
					$classes[] = 'layout-masonry';
				}
				break;
			case 'grid':
				$classes[] = 'layout-grid';
				if ( $desc_on_hoover ) {
					$classes[] = 'grid-text-hovers';
				}
				break;
			case 'checkerboard':
			case 'list': $classes[] = 'layout-list'; break;
		}

		// hover classes
		if ( in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team')) ) {
			$classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image';
		}

		// hide dividers if content is off
		if ( in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout') ) {
			$show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links');
			if ( !$show_dividers ) $classes[] = 'description-off';
		}

		if ( is_single() ) {
			$post_type = get_post_type();
			if ( 'dt_portfolio' == $post_type && ( post_password_required() || ( !comments_open() && '0' == get_comments_number() ) ) ) {
				$classes[] = 'no-comments';
			} else if ( 'post' == $post_type && !of_get_option( 'general-blog_meta_postformat', 1 ) ) {
				$classes[] = 'post-format-icons-disabled';
			}
		}

		if ( in_array('single-dt_portfolio', $classes) ) {
			$key = array_search('single-dt_portfolio', $classes);
			$classes[ $key ] = 'single-portfolio';
		}

		switch ( $config->get('header_background') ) {
			case 'overlap': $classes['header_background'] = 'overlap'; break;
			case 'transparent': $classes['header_background'] = 'transparent';
		}

		if ( 'fancy' == $config->get( 'header_title' ) ) {
			$classes[] = 'fancy-header-on';
		} elseif ( 'slideshow' == $config->get( 'header_title' ) ) {
			$classes[] = 'slideshow-on';

			if ( '3d' == $config->get( 'slideshow_mode' ) && 'fullscreen-content' == $config->get( 'slideshow_3d_layout' ) ) {
				$classes[] = 'threed-fullscreen';
			}

			if ( dt_get_paged_var() > 1 && isset($classes['header_background']) ) {
				unset($classes['header_background']);
			}

		} elseif ( is_single() && 'disabled' == $config->get( 'header_title' ) ) {
			$classes[] = 'title-off';
		}

		// hoover style
		switch( of_get_option('hoover-style', 'none') ) {
			case 'grayscale': $classes[] = 'filter-grayscale-static'; break;
			case 'gray+color': $classes[] = 'filter-grayscale'; break;
			case 'blur' : $classes[] = 'image-blur'; break;
		}

		// add boxed-class to body
		if ( 'boxed' == of_get_option('general-layout', 'wide') ) {
			$classes[] = 'boxed-layout';
		}

		if ( !presscore_responsive() ) {
			$classes[] = 'responsive-off';
		}

		// justified grid
		if ( $config->get( 'justified_grid' ) ) {
			$classes[] = 'justified-grid';
		}

		// general style
		if ( 'minimalistic' == of_get_option('general-style') ) {
			$classes[] = 'style-minimal';
		}

		// buttons style
		switch ( of_get_option('buttons-style', 'ios7') ) {
			case 'flat': $classes[] = 'btn-flat'; break;
			case '3d': $classes[] = 'btn-3d'; break;
			case 'ios7':
			default: $classes[] = 'btn-ios'; break;
		}

		return array_values( array_unique( $classes ) );
	}
Exemplo n.º 12
0
 /**
  * Get Categorizer sorting fields.
  *
  * @since 1.0.0
  */
 function presscore_get_categorizer_sorting_fields()
 {
     $config = presscore_get_config();
     $show_orderby = $config->get('template.posts_filter.orderby.enabled');
     $show_order = $config->get('template.posts_filter.order.enabled');
     // if filter or all sorting buttons disabled - return empty string
     if (!$show_orderby && !$show_order) {
         return '';
     }
     $request_display = $config->get('request_display');
     if (null !== $request_display) {
         $display = $request_display;
     } else {
         $display = $config->get('display');
         $display['select'] = 'all';
     }
     $select = isset($display['select']) ? $display['select'] : 'all';
     $term_id = isset($display['terms_ids']) ? current((array) $display['terms_ids']) : array();
     $term = '';
     if ('except' == $select && 0 === $term_id) {
         $term = 'none';
     } else {
         if ('only' == $select) {
             $term = absint($term_id);
         }
     }
     $paged = dt_get_paged_var();
     if ($paged > 1) {
         $base_link = get_pagenum_link($paged, false);
     } else {
         $base_link = get_permalink();
     }
     //////////////
     // output //
     //////////////
     $link = add_query_arg('term', $term, $base_link);
     $act = ' act';
     $display_none = ' style="display: none;"';
     $orderby = $config->get('orderby');
     $order = $config->get('order');
     $html = '<div class="filter-extras">' . "\n" . '<div class="filter-by"' . ($show_orderby ? '' : $display_none) . '>' . "\n" . '<a href="' . esc_url(add_query_arg(array('orderby' => 'date', 'order' => $order), $link)) . '" class="sort-by-date' . ('date' == $orderby ? $act : '') . '" data-by="date">' . __('Date', 'the7mk2') . '</a>' . "\n" . '<span class="filter-switch"></span>' . '<a href="' . esc_url(add_query_arg(array('orderby' => 'name', 'order' => $order), $link)) . '" class="sort-by-name' . ('name' == $orderby ? $act : '') . '" data-by="name">' . __('Name', 'the7mk2') . '</a>' . "\n" . '</div>' . "\n" . '<div class="filter-sorting"' . ($show_order ? '' : $display_none) . '>' . "\n" . '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'DESC'), $link)) . '" class="sort-by-desc' . ('DESC' == $order ? $act : '') . '" data-sort="desc">' . __('Desc', 'the7mk2') . '</a>' . '<span class="filter-switch"></span>' . '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'ASC'), $link)) . '" class="sort-by-asc' . ('ASC' == $order ? $act : '') . '" data-sort="asc">' . __('Asc', 'the7mk2') . '</a>' . '</div>' . "\n" . '</div>' . "\n";
     return $html;
 }
 function presscore_get_blog_query()
 {
     $config = presscore_get_config();
     $orderby = $config->get('orderby');
     $query_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $config->get('order'), 'orderby' => 'name' == $orderby ? 'title' : $orderby);
     $ppp = $config->get('posts_per_page');
     if ($ppp) {
         $query_args['posts_per_page'] = intval($ppp);
     }
     $display = $config->get('display');
     if (!empty($display['terms_ids'])) {
         $terms_ids = array_values($display['terms_ids']);
         switch ($display['select']) {
             case 'only':
                 $query_args['category__in'] = $terms_ids;
                 break;
             case 'except':
                 $query_args['category__not_in'] = $terms_ids;
         }
     }
     // get filter request
     $request_display = $config->get('request_display');
     if ($request_display) {
         // get all category terms
         $all_terms = get_categories(array('type' => 'post', 'hide_empty' => 1, 'hierarchical' => 0, 'taxonomy' => 'category', 'pad_counts' => false));
         // populate $all_terms_array with terms names
         $all_terms_array = array();
         foreach ($all_terms as $term) {
             $all_terms_array[] = $term->term_id;
         }
         // except for empty term that appers when all filter category selcted, see it's url
         if (0 == current($request_display['terms_ids'])) {
             $request_display['terms_ids'] = $all_terms_array;
         }
         // override base tax_query
         $query_args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => array_values($request_display['terms_ids']), 'operator' => 'IN'));
         if ('except' == $request_display['select']) {
             $query_args['tax_query'][0]['operator'] = 'NOT IN';
         }
     }
     $query = new WP_Query($query_args);
     return $query;
 }
Exemplo n.º 14
0
 function presscore_body_class($classes)
 {
     $config = Presscore_Config::get_instance();
     $desc_on_hoover = 'under_image' != $config->get('post.preview.description.style');
     $template = $config->get('template');
     $layout = $config->get('layout');
     ///////////////////////
     // template classes //
     ///////////////////////
     switch ($template) {
         case 'blog':
             $classes[] = 'blog';
             break;
         case 'portfolio':
             $classes[] = 'portfolio';
             break;
         case 'team':
             $classes[] = 'team';
             break;
         case 'testimonials':
             $classes[] = 'testimonials';
             break;
         case 'archive':
             $classes[] = 'archive';
             break;
         case 'search':
             $classes[] = 'search';
             break;
         case 'albums':
             $classes[] = 'albums';
             break;
         case 'media':
             $classes[] = 'media';
             break;
         case 'microsite':
             $classes[] = 'one-page-row';
             break;
     }
     /////////////////////
     // layout classes //
     /////////////////////
     switch ($layout) {
         case 'masonry':
             if ($desc_on_hoover) {
                 $classes[] = 'layout-masonry-grid';
             } else {
                 $classes[] = 'layout-masonry';
             }
             break;
         case 'grid':
             $classes[] = 'layout-grid';
             if ($desc_on_hoover) {
                 $classes[] = 'grid-text-hovers';
             }
             break;
         case 'checkerboard':
         case 'list':
         case 'right_list':
             $classes[] = 'layout-list';
             break;
     }
     ////////////////////
     // hover classes //
     ////////////////////
     if (in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team'))) {
         $classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image';
     }
     //////////////////////////////////////
     // hide dividers if content is off //
     //////////////////////////////////////
     if (in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout')) {
         $show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links');
         if (!$show_dividers) {
             $classes[] = 'description-off';
         }
     }
     /////////////////////
     // single classes //
     /////////////////////
     if (is_single() && (post_password_required() || !comments_open() && '0' == get_comments_number())) {
         $classes[] = 'no-comments';
     }
     ////////////////////////
     // header background //
     ////////////////////////
     if (presscore_mixed_header_with_top_line()) {
         $classes[] = 'header-top-line-active';
     }
     if (presscore_header_with_bg() && (presscore_mixed_header_with_top_line() || !presscore_header_layout_is_side())) {
         switch ($config->get('header_background')) {
             case 'overlap':
                 $classes['header_background'] = 'overlap';
                 break;
             case 'transparent':
                 $classes['header_background'] = 'transparent';
                 if ('light' === $config->get('header.transparent.color_scheme')) {
                     $classes[] = 'light-preset-color';
                 }
                 break;
         }
         if ($config->get_bool('header.slideshow.header_below') && 'slideshow' === $config->get('header_title') && in_array($config->get('header_background'), array('transparent', 'normal'))) {
             $classes[] = 'floating-navigation-below-slider';
         }
     }
     ///////////////////
     // header title //
     ///////////////////
     if ('fancy' == $config->get('header_title')) {
         $classes[] = 'fancy-header-on';
     } elseif ('slideshow' == $config->get('header_title')) {
         $classes[] = 'slideshow-on';
         if ('3d' == $config->get('slideshow_mode') && 'fullscreen-content' == $config->get('slideshow_3d_layout')) {
             $classes[] = 'threed-fullscreen';
         }
         if (dt_get_paged_var() > 1 && isset($classes['header_background'])) {
             unset($classes['header_background']);
         }
     } elseif (is_single() && 'disabled' == $config->get('header_title')) {
         $classes[] = 'title-off';
     }
     ///////////////////
     // hover style //
     ///////////////////
     switch ($config->get('template.images.hover.style')) {
         case 'grayscale':
             $classes[] = 'filter-grayscale-static';
             break;
         case 'gray_color':
             $classes[] = 'filter-grayscale';
             break;
         case 'blur':
             $classes[] = 'image-blur';
             break;
         case 'scale':
             $classes[] = 'scale-on-hover';
             break;
     }
     // default hover icons
     switch ($config->get('template.images.hover.icon')) {
         case 'none':
             $classes[] = 'disabled-hover-icons';
             break;
         case 'small_corner':
             $classes[] = 'small-hover-icons';
             break;
         case 'big_center':
             $classes[] = 'large-hover-icons';
             break;
     }
     if ($config->get('template.images.hover.animation')) {
         $classes[] = 'click-effect-on-img';
     }
     ////////////
     // boxed //
     ////////////
     if ('boxed' == $config->get('template.layout')) {
         $classes[] = 'boxed-layout';
     }
     /////////////////////
     // responsiveness //
     /////////////////////
     if (!presscore_responsive()) {
         $classes[] = 'responsive-off';
     }
     /////////////////////
     // justified grid //
     /////////////////////
     if ($config->get('justified_grid')) {
         $classes[] = 'justified-grid';
     }
     ////////////////////
     // header layout //
     ////////////////////
     switch ($config->get('header.position')) {
         case 'right':
             $classes[] = 'header-side-right';
             break;
         case 'left':
             $classes[] = 'header-side-left';
             break;
     }
     switch ($config->get('header.layout')) {
         case 'slide_out':
             $classes[] = 'sticky-header';
             break;
         case 'overlay':
             $classes[] = 'overlay-navigation';
             break;
     }
     switch ($config->get('header.layout.slide_out.animation')) {
         case 'fade':
             $classes[] = 'fade-header-animation';
             break;
         case 'move':
             $classes[] = 'move-header-animation';
             break;
         case 'slide':
             $classes[] = 'slide-header-animation';
             break;
     }
     if ('side_line' === $config->get('header.mixed.view')) {
         $classes[] = 'header-side-line';
         switch ($config->get('header.mixed.view.side_line.position')) {
             case 'above':
                 $classes[] = 'header-above-side-line';
                 break;
             case 'under':
                 $classes[] = 'header-under-side-line';
                 break;
         }
     }
     if ($config->get('header.layout.slide_out.x_cursor.enabled')) {
         $classes[] = 'overlay-cursor-on';
     }
     //////////////////////
     // accent gradient //
     //////////////////////
     if ('gradient' == $config->get('template.accent.color.mode')) {
         $classes[] = 'accent-gradient';
     }
     //////////////////////////////
     // srcset based hd images //
     //////////////////////////////
     if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) {
         $classes[] = 'srcset-enabled';
     }
     ///////////////
     // buttons //
     ///////////////
     // buttons style
     switch ($config->get('buttons.style')) {
         case '3d':
             $classes[] = 'btn-3d';
             break;
         case 'flat':
             $classes[] = 'btn-flat';
             break;
         case 'material':
             $classes[] = 'btn-material';
             break;
         case 'ios7':
         default:
             $classes[] = 'btn-ios';
             break;
     }
     // buttons text color
     switch ($config->get('buttons.text.color')) {
         case 'accent':
             $classes[] = 'accent-btn-color';
             break;
         case 'color':
             $classes[] = 'custom-btn-color';
             break;
     }
     // buttons hover text color
     switch ($config->get('buttons.hover.text.color')) {
         case 'accent':
             $classes[] = 'accent-btn-hover-color';
             break;
         case 'color':
             $classes[] = 'custom-btn-hover-color';
             break;
     }
     if ($config->get('template.footer.background.slideout_mode')) {
         $classes[] = 'footer-overlap';
     }
     ////////////////////////
     // content boxes bg //
     ////////////////////////
     switch ($config->get('template.content.boxes.background.decoration')) {
         case 'shadow':
             $classes[] = 'shadow-element-decoration';
             break;
         case 'outline':
             $classes[] = 'outline-element-decoration';
             break;
     }
     ////////////////////
     // filter style //
     ////////////////////
     switch ($config->get('template.posts_filter.style')) {
         case 'ios':
             $classes[] = 'filter-style-ios';
             break;
         case 'minimal':
             $classes[] = 'filter-style-minimal';
             break;
         case 'material':
             $classes[] = 'filter-style-material';
             break;
     }
     //////////////////////////
     // contact form style //
     //////////////////////////
     switch ($config->get('template.contact_form.style')) {
         case 'ios':
             $classes[] = 'contact-form-ios';
             break;
         case 'minimal':
             $classes[] = 'contact-form-minimal';
             break;
         case 'material':
             $classes[] = 'contact-form-material';
             break;
     }
     ///////////////////////
     // fancy date size //
     ///////////////////////
     if ('small' == $config->get('post.fancy_date.size')) {
         $classes[] = 'small-fancy-datas';
     } else {
         $classes[] = 'large-fancy-datas';
     }
     if ($config->get_bool('header.layout.slide_out.blur.enabled')) {
         $classes[] = 'blur-page';
     }
     ///////////////////////////////
     // slideshow bullets style //
     ///////////////////////////////
     switch ($config->get('slideshow.bullets.style')) {
         case 'transparent':
             $classes[] = 'semitransparent-bullets';
             break;
         case 'accent':
             $classes[] = 'accent-bullets';
             break;
         case 'outline':
             $classes[] = 'outlines-bullets';
             break;
     }
     ///////////////////
     // icons style //
     ///////////////////
     switch ($config->get('template.icons.style')) {
         case 'bold':
             $classes[] = 'bold-icons';
             break;
         case 'light':
             $classes[] = 'light-icons';
             break;
     }
     /////////////////////
     // floating menu //
     /////////////////////
     if ($config->get('header.floating_navigation.enabled')) {
         $classes[] = presscore_array_value($config->get('header.floating_navigation.style'), array('fade' => 'phantom-fade', 'slide' => 'phantom-slide', 'sticky' => 'phantom-sticky'));
         $classes[] = presscore_array_value($config->get('header.floating_navigation.decoraion'), array('disabled' => 'phantom-disable-decoration', 'shadow' => 'phantom-shadow-decoration', 'line' => 'phantom-line-decoration'));
         $classes[] = presscore_array_value($config->get('header.floating_navigation.logo.style'), array('custom' => 'phantom-custom-logo-on', 'main' => 'phantom-main-logo-on', 'none' => 'phantom-logo-off'));
     }
     $classes[] = presscore_array_value($config->get('header.mobile.floatin_navigation'), array('sticky' => 'sticky-mobile-header', 'menu_icon' => 'floating-mobile-menu-icon'));
     ////////////////////////////////////
     // Sidebar and footer on mobile //
     ////////////////////////////////////
     if ('disabled' != $config->get('sidebar_position') && $config->get('sidebar_hide_on_mobile')) {
         $classes[] = 'mobile-hide-sidebar';
     }
     if ($config->get('footer_show') && $config->get('footer_hide_on_mobile')) {
         $classes[] = 'mobile-hide-footer';
     }
     if (in_array($config->get('header.layout'), array('classic', 'inline', 'split'))) {
         $classes[] = 'top-header';
     }
     // mobile logo
     $classes[] = presscore_array_value($config->get('header.mobile.logo.first_switch.layout'), array('left_right' => 'first-switch-logo-right first-switch-menu-left', 'left_center' => 'first-switch-logo-center first-switch-menu-left', 'right_left' => 'first-switch-logo-left first-switch-menu-right', 'right_center' => 'first-switch-logo-center first-switch-menu-right'));
     $classes[] = presscore_array_value($config->get('header.mobile.logo.second_switch.layout'), array('left_right' => 'second-switch-logo-right second-switch-menu-left', 'left_center' => 'second-switch-logo-center second-switch-menu-left', 'right_left' => 'second-switch-logo-left second-switch-menu-right', 'right_center' => 'second-switch-logo-center second-switch-menu-right'));
     if ('right' === $config->get('header.mobile.menu.align')) {
         $classes[] = 'right-mobile-menu';
     }
     /////////////
     // return //
     /////////////
     return array_values(array_unique($classes));
 }
Exemplo n.º 15
0
 /**
  * [presscore_list_container_data_atts description]
  *
  * @since 2.1.0
  * 
  * @return satring [description]
  */
 function presscore_list_container_data_atts($custom_atts = array())
 {
     $data_atts = array('data-cur-page="' . dt_get_paged_var() . '"');
     $data_atts = array_merge($data_atts, $custom_atts);
     return ' ' . implode(' ', $data_atts);
 }
Exemplo n.º 16
0
 function presscore_blog_ajax_loading_responce($ajax_data = array())
 {
     global $post, $wp_query, $paged, $page;
     extract($ajax_data);
     if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
         $responce = array('success' => false, 'reason' => 'corrupted data');
     } else {
         require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
         require_once PRESSCORE_DIR . '/template-hooks.php';
         require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
         // get page
         query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
         if (have_posts() && !post_password_required()) {
             while (have_posts()) {
                 the_post();
                 // main loop
                 $config = Presscore_Config::get_instance();
                 $config->set('template', 'blog');
                 $config->set('template.layout.type', 'masonry');
                 presscore_config_base_init();
                 presscore_post_meta_new_controller();
                 do_action('presscore_before_loop');
                 $orderby = $config->get('orderby');
                 $query_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $config->get('order'), 'orderby' => 'name' == $orderby ? 'title' : $orderby);
                 $ppp = $config->get('posts_per_page');
                 if ($ppp) {
                     $query_args['posts_per_page'] = intval($ppp);
                 }
                 $display = $config->get('display');
                 if (!empty($display['terms_ids'])) {
                     $terms_ids = array_values($display['terms_ids']);
                     switch ($display['select']) {
                         case 'only':
                             $query_args['category__in'] = $terms_ids;
                             break;
                         case 'except':
                             $query_args['category__not_in'] = $terms_ids;
                     }
                 }
                 $query = new WP_Query($query_args);
                 $html = '';
                 ob_start();
                 if ($query->have_posts()) {
                     while ($query->have_posts()) {
                         $query->the_post();
                         // check if current post already loaded
                         $key_in_loaded = array_search($post->ID, $loaded_items);
                         if (false !== $key_in_loaded) {
                             unset($loaded_items[$key_in_loaded]);
                             continue;
                         }
                         presscore_populate_post_config();
                         // post template
                         dt_get_template_part('blog/masonry/blog-masonry-post');
                     }
                     wp_reset_postdata();
                 }
                 $html .= ob_get_clean();
             }
             $responce = array('success' => true);
             ///////////////////
             // pagination //
             ///////////////////
             $next_page_link = dt_get_next_posts_url($query->max_num_pages);
             if ($next_page_link) {
                 $responce['nextPage'] = dt_get_paged_var() + 1;
             } else {
                 $responce['nextPage'] = 0;
             }
             $load_style = $config->get('load_style');
             // pagination style
             if (presscore_is_load_more_pagination()) {
                 $pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
                 if ($pagination) {
                     $responce['currentPage'] = dt_get_paged_var();
                     $responce['paginationHtml'] = $pagination;
                 } else {
                     $responce['currentPage'] = $post_paged;
                 }
                 $responce['paginationType'] = 'more';
             } else {
                 if ('ajax_pagination' == $load_style) {
                     ob_start();
                     dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
                     $pagination = ob_get_clean();
                     if ($pagination) {
                         $responce['paginationHtml'] = $pagination;
                     }
                     $responce['paginationType'] = 'paginator';
                 }
             }
             /////////////////
             // response //
             /////////////////
             $responce['itemsToDelete'] = array_values($loaded_items);
             // $responce['query'] = $page_query->query;
             $responce['order'] = $query->query['order'];
             $responce['orderby'] = $query->query['orderby'];
         }
         // main loop
         $responce['html'] = $html;
     }
     return $responce;
 }
 /**
  * Slideshow controller.
  *
  */
 function presscore_slideshow_controller()
 {
     global $post;
     $config = Presscore_Config::get_instance();
     if ('slideshow' != $config->get('header_title')) {
         return;
     }
     // turn off regular titles and breadcrumbs
     remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16);
     if (dt_get_paged_var() > 1) {
         return;
     }
     switch ($config->get('slideshow_mode')) {
         case 'revolution':
             $rev_slider = $config->get('slideshow_revolution_slider');
             if ($rev_slider && function_exists('putRevSlider')) {
                 echo '<div id="main-slideshow">';
                 putRevSlider($rev_slider);
                 echo '</div>';
             }
             break;
         case 'layer':
             $layer_slider = $config->get('slideshow_layer_slider');
             $layer_bg_and_paddings = $config->get('slideshow_layer_bg_and_paddings');
             if ($layer_slider && function_exists('layerslider')) {
                 echo '<div id="main-slideshow"' . ($layer_bg_and_paddings ? ' class="layer-fixed"' : '') . '>';
                 layerslider($layer_slider);
                 echo '</div>';
             }
     }
     // switch
     do_action('presscore_do_header_slideshow', $config->get('slideshow_mode'));
 }
Exemplo n.º 18
0
 /**
  * Get Categorizer sorting fields.
  */
 function presscore_get_categorizer_sorting_fields()
 {
     $config = Presscore_Config::get_instance();
     $request_display = $config->get('request_display');
     $orderby = $config->get('orderby');
     $order = $config->get('order');
     if (null !== $request_display) {
         $display = $request_display;
     } else {
         $display = $config->get('display');
     }
     $select = isset($display['select']) ? $display['select'] : 'all';
     $term_id = isset($display['terms_ids']) ? current((array) $display['terms_ids']) : array();
     $paged = dt_get_paged_var();
     $term = '';
     if ('except' == $select && 0 === $term_id) {
         $term = 'none';
     } else {
         if ('only' == $select) {
             $term = absint($term_id);
         }
     }
     if ($paged > 1) {
         $base_link = get_pagenum_link($paged);
     } else {
         $base_link = get_permalink();
     }
     $link = add_query_arg('term', $term, $base_link);
     $act = ' class="act"';
     $html = '<div class="filter-extras">' . "\n" . '<div class="filter-by">' . "\n";
     $html .= '<a href="' . esc_url(add_query_arg(array('orderby' => 'date', 'order' => $order), $link)) . '" data-by="date"' . ('date' == $orderby ? $act : '') . '>' . __('Date', LANGUAGE_ZONE) . '</a>' . "\n";
     $html .= '<span class="filter-switch"></span>';
     $html .= '<a href="' . esc_url(add_query_arg(array('orderby' => 'name', 'order' => $order), $link)) . '" data-by="name"' . ('name' == $orderby ? $act : '') . '>' . __('Name', LANGUAGE_ZONE) . '</a>' . "\n";
     $html .= '</div>' . "\n" . '<div class="filter-sorting">' . "\n";
     $html .= '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'DESC'), $link)) . '" data-sort="desc"' . ('DESC' == $order ? $act : '') . '>' . __('Desc', LANGUAGE_ZONE) . '</a>';
     $html .= '<span class="filter-switch"></span>';
     $html .= '<a href="' . esc_url(add_query_arg(array('orderby' => $orderby, 'order' => 'ASC'), $link)) . '" data-sort="asc"' . ('ASC' == $order ? $act : '') . '>' . __('Asc', LANGUAGE_ZONE) . '</a>';
     $html .= '</div>' . "\n" . '</div>' . "\n";
     return $html;
 }
Exemplo n.º 19
0
 /**
  * Slideshow controller.
  *
  */
 function presscore_slideshow_controller()
 {
     global $post;
     $config = Presscore_Config::get_instance();
     if ('slideshow' != $config->get('header_title')) {
         return;
     }
     $slider_id = $config->get('slideshow_sliders');
     // turn off regular titles and breadcrumbs
     remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16);
     if (dt_get_paged_var() > 1) {
         return;
     }
     switch ($config->get('slideshow_mode')) {
         case 'porthole':
             $class = 'fixed' == $config->get('slideshow_layout') ? 'class="fixed" ' : '';
             $height = absint($config->get('slideshow_slider_height'));
             $width = absint($config->get('slideshow_slider_width'));
             if (!$height) {
                 $height = 500;
             }
             if (!$width) {
                 $width = 1200;
             }
             printf('<div id="main-slideshow" %sdata-width="%d" data-height="%d" data-autoslide="%d" data-scale="%s" data-paused="%s"></div>', $class, $width, $height, absint($config->get('slideshow_autoslide_interval')), 'fit' == $config->get('slideshow_slider_scaling') ? 'fit' : 'fill', 'paused' == $config->get('slideshow_autoplay') ? 'true' : 'false');
             add_action('wp_footer', 'presscore_render_porthole_slider_data', 15);
             break;
         case 'metro':
             $slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id($slider_id);
             // prepare data
             if ($slideshow->have_posts()) {
                 $slideshow_objects = array();
                 while ($slideshow->have_posts()) {
                     $slideshow->the_post();
                     $media_items = get_post_meta($post->ID, '_dt_slider_media_items', true);
                     if (empty($media_items)) {
                         continue;
                     }
                     $attachments_data = presscore_get_attachment_post_data($media_items);
                     if (count($attachments_data) > 1) {
                         $object = array();
                         foreach ($attachments_data as $array) {
                             $object[] = Presscoe_Inc_Classes_SwapperSlider::array_to_object($array);
                         }
                     } else {
                         $object = Presscoe_Inc_Classes_SwapperSlider::array_to_object(current($attachments_data));
                     }
                     $slideshow_objects[] = $object;
                 }
                 wp_reset_postdata();
                 echo Presscoe_Inc_Classes_SwapperSlider::get_html($slideshow_objects);
             }
             break;
         case '3d':
             $class = '';
             $data_attr = '';
             $slider_layout = $config->get('slideshow_3d_layout');
             if (in_array($slider_layout, array('prop-fullwidth', 'prop-content-width'))) {
                 $class = 'prop-fullwidth' == $slider_layout ? 'class="fixed-height" ' : 'class="fixed" ';
                 $width = $config->get('slideshow_3d_slider_width');
                 $height = $config->get('slideshow_3d_slider_height');
                 $data_attr = sprintf(' data-width="%d" data-height="%d"', $width ? absint($width) : 2500, $height ? absint($height) : 1200);
             }
             printf('<div id="main-slideshow" %s><div class="three-d-slider"%s><span id="loading">0</span></div></div>', $class, $data_attr);
             add_action('wp_footer', 'presscore_render_3d_slider_data', 15);
             break;
         case 'revolution':
             $rev_slider = $config->get('slideshow_revolution_slider');
             if ($rev_slider && function_exists('putRevSlider')) {
                 echo '<div id="main-slideshow">';
                 putRevSlider($rev_slider);
                 echo '</div>';
             }
             break;
         case 'layer':
             $layer_slider = $config->get('slideshow_layer_slider');
             $layer_bg_and_paddings = $config->get('slideshow_layer_bg_and_paddings');
             if ($layer_slider && function_exists('layerslider')) {
                 echo '<div id="main-slideshow"' . ($layer_bg_and_paddings ? ' class="layer-fixed"' : '') . '>';
                 layerslider($layer_slider);
                 echo '</div>';
             }
     }
     // switch
 }
Exemplo n.º 20
0
 function presscore_testimonials_ajax_loading_responce($ajax_data = array())
 {
     global $post, $wp_query, $paged, $page;
     extract($ajax_data);
     if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
         $responce = array('success' => false, 'reason' => 'corrupted data');
     } else {
         require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
         require_once PRESSCORE_DIR . '/template-hooks.php';
         require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
         // get page
         query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
         if (have_posts() && !post_password_required()) {
             while (have_posts()) {
                 the_post();
                 // main loop
                 $config = presscore_get_config();
                 $config->set('template', 'testimonials');
                 $config->set('template.layout.type', 'masonry');
                 presscore_config_base_init();
                 do_action('presscore_before_loop');
                 $query = Presscore_Inc_Testimonials_Post_Type::get_template_query();
                 $html = '';
                 ob_start();
                 if ($query->have_posts()) {
                     while ($query->have_posts()) {
                         $query->the_post();
                         /*
                         						// check if current post already loaded
                         						$key_in_loaded = array_search( $post->ID, $loaded_items );
                         						if ( false !== $key_in_loaded ) {
                         							unset( $loaded_items[ $key_in_loaded ] );
                         							continue;
                         						}
                         */
                         // post template
                         get_template_part('content', 'testimonials');
                     }
                     wp_reset_postdata();
                 }
                 $html .= ob_get_clean();
             }
             $responce = array('success' => true);
             ///////////////////
             // pagination //
             ///////////////////
             $next_page_link = dt_get_next_posts_url($query->max_num_pages);
             if ($next_page_link) {
                 $responce['nextPage'] = dt_get_paged_var() + 1;
             } else {
                 $responce['nextPage'] = 0;
             }
             $load_style = $config->get('load_style');
             // pagination style
             if (presscore_is_load_more_pagination()) {
                 $pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
                 if ($pagination) {
                     $responce['currentPage'] = dt_get_paged_var();
                     $responce['paginationHtml'] = $pagination;
                 } else {
                     $responce['currentPage'] = $post_paged;
                 }
                 $responce['paginationType'] = 'more';
             } else {
                 if ('ajax_pagination' == $load_style) {
                     ob_start();
                     dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
                     $pagination = ob_get_clean();
                     if ($pagination) {
                         $responce['paginationHtml'] = $pagination;
                     }
                     $responce['paginationType'] = 'paginator';
                 }
             }
             /////////////////
             // response //
             /////////////////
             $responce['itemsToDelete'] = array_values($loaded_items);
             // $responce['query'] = $page_query->query;
             $responce['order'] = $query->get('order', '');
             $responce['orderby'] = $query->get('orderby', 'date');
         }
         // main loop
         $responce['html'] = $html;
     }
     return $responce;
 }
Exemplo n.º 21
0
 /**
  * Slideshow controller.
  *
  */
 function presscore_slideshow_controller()
 {
     global $post;
     $config = Presscore_Config::get_instance();
     if ('slideshow' != $config->get('header_title')) {
         return;
     }
     $slider_id = $config->get('slideshow_sliders');
     // turn off regular titles and breadcrumbs
     remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16);
     if (dt_get_paged_var() > 1) {
         return;
     }
     switch ($config->get('slideshow_mode')) {
         case 'porthole':
             $class = 'fixed' == $config->get('slideshow_layout') ? 'class="fixed" ' : '';
             $height = absint($config->get('slideshow_slider_height'));
             $width = absint($config->get('slideshow_slider_width'));
             if (!$height) {
                 $height = 500;
             }
             if (!$width) {
                 $width = 1200;
             }
             printf('<div id="main-slideshow" %sdata-width="%d" data-height="%d" data-autoslide="%d" data-scale="%s" data-paused="%s"></div>', $class, $width, $height, absint($config->get('slideshow_autoslide_interval')), 'fit' == $config->get('slideshow_slider_scaling') ? 'fit' : 'fill', 'paused' == $config->get('slideshow_autoplay') ? 'true' : 'false');
             add_action('wp_footer', 'presscore_render_porthole_slider_data', 15);
             break;
         case 'photo_scroller':
             $slides = array();
             $slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id($slider_id);
             // prepare data
             if ($slideshow->have_posts()) {
                 while ($slideshow->have_posts()) {
                     $slideshow->the_post();
                     $media_items = get_post_meta($post->ID, '_dt_slider_media_items', true);
                     if (empty($media_items)) {
                         continue;
                     }
                     $slides = array_merge($slides, $media_items);
                 }
                 wp_reset_postdata();
             }
             $photo_scroller = new Presscore_PhotoScroller($slides, array('wrap_class' => 'fullscreen' == $config->get('slideshow.photo_scroller.layout') ? 'fullscreen-scroller' : '', 'background_color' => $config->get('slideshow.photo_scroller.background.color'), 'padding_top' => $config->get('slideshow.photo_scroller.padding.top'), 'padding_bottom' => $config->get('slideshow.photo_scroller.padding.bottom'), 'padding_side' => $config->get('slideshow.photo_scroller.padding.side'), 'autoplay' => 'play' == $config->get('slideshow.photo_scroller.autoplay.mode'), 'autoplay_speed' => $config->get('slideshow.photo_scroller.autoplay.speed'), 'thumbnails_visibility' => $config->get('slideshow.photo_scroller.thumbnails.visibility'), 'thumbnails_width' => $config->get('slideshow.photo_scroller.thumbnail.width'), 'thumbnails_height' => $config->get('slideshow.photo_scroller.thumbnail.height'), 'portrait_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.mobile')), 'landscape_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.mobile')), 'inactive_opacity' => $config->get('slideshow.photo_scroller.inactive.opacity'), 'show_overlay' => $config->get('slideshow.photo_scroller.overlay.enabled'), 'show_post_navigation' => false, 'show_share_buttons' => false));
             if ($photo_scroller->have_slides()) {
                 echo $photo_scroller->get_html();
             }
             break;
             /*
             			case 'metro':
             				$slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id( $slider_id );
             
             				// prepare data
             				if ( $slideshow->have_posts() ) {
             
             					$slideshow_objects = array();
             
             					while ( $slideshow->have_posts() ) {
             
             						$slideshow->the_post();
             
             						$media_items = get_post_meta( $post->ID, '_dt_slider_media_items', true );
             						if ( empty($media_items) ) {
             							continue;
             						}
             
             						$attachments_data = presscore_get_attachment_post_data( $media_items );
             
             						if ( count($attachments_data) > 1 ) {
             
             							$object = array();
             							foreach ( $attachments_data as $array ) {
             								$object[] = Presscoe_Inc_Classes_SwapperSlider::array_to_object( $array );
             							}
             						} else {
             
             							$object = Presscoe_Inc_Classes_SwapperSlider::array_to_object( current($attachments_data) );
             						}
             
             						$slideshow_objects[] = $object;
             					}
             					wp_reset_postdata();
             					
             					echo Presscoe_Inc_Classes_SwapperSlider::get_html( $slideshow_objects );
             				}
             				break;
             */
         /*
         			case 'metro':
         				$slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id( $slider_id );
         
         				// prepare data
         				if ( $slideshow->have_posts() ) {
         
         					$slideshow_objects = array();
         
         					while ( $slideshow->have_posts() ) {
         
         						$slideshow->the_post();
         
         						$media_items = get_post_meta( $post->ID, '_dt_slider_media_items', true );
         						if ( empty($media_items) ) {
         							continue;
         						}
         
         						$attachments_data = presscore_get_attachment_post_data( $media_items );
         
         						if ( count($attachments_data) > 1 ) {
         
         							$object = array();
         							foreach ( $attachments_data as $array ) {
         								$object[] = Presscoe_Inc_Classes_SwapperSlider::array_to_object( $array );
         							}
         						} else {
         
         							$object = Presscoe_Inc_Classes_SwapperSlider::array_to_object( current($attachments_data) );
         						}
         
         						$slideshow_objects[] = $object;
         					}
         					wp_reset_postdata();
         					
         					echo Presscoe_Inc_Classes_SwapperSlider::get_html( $slideshow_objects );
         				}
         				break;
         */
         case '3d':
             $class = '';
             $data_attr = '';
             $slider_layout = $config->get('slideshow_3d_layout');
             if (in_array($slider_layout, array('prop-fullwidth', 'prop-content-width'))) {
                 $class = 'prop-fullwidth' == $slider_layout ? 'class="fixed-height" ' : 'class="fixed" ';
                 $width = $config->get('slideshow_3d_slider_width');
                 $height = $config->get('slideshow_3d_slider_height');
                 $data_attr = sprintf(' data-width="%d" data-height="%d"', $width ? absint($width) : 2500, $height ? absint($height) : 1200);
             }
             printf('<div id="main-slideshow" %s><div class="three-d-slider"%s><span id="loading">0</span></div></div>', $class, $data_attr);
             add_action('wp_footer', 'presscore_render_3d_slider_data', 15);
             break;
         case 'revolution':
             $rev_slider = $config->get('slideshow_revolution_slider');
             if ($rev_slider && function_exists('putRevSlider')) {
                 echo '<div id="main-slideshow">';
                 putRevSlider($rev_slider);
                 echo '</div>';
             }
             break;
         case 'layer':
             $layer_slider = $config->get('slideshow_layer_slider');
             $layer_bg_and_paddings = $config->get('slideshow_layer_bg_and_paddings');
             if ($layer_slider && function_exists('layerslider')) {
                 echo '<div id="main-slideshow"' . ($layer_bg_and_paddings ? ' class="layer-fixed"' : '') . '>';
                 layerslider($layer_slider);
                 echo '</div>';
             }
     }
     // switch
 }
Exemplo n.º 22
0
 /**
  * Get media posts in masonry layout.
  *
  */
 public static function get_media_masonry_content($ajax_data = array())
 {
     global $post, $wp_query, $paged, $page;
     extract($ajax_data);
     if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
         $responce = array('success' => false, 'reason' => 'corrupted data');
     } else {
         /**
          * Include AQResizer.
          *
          */
         require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
         /**
          * Include helpers.
          *
          */
         require_once PRESSCORE_DIR . '/helpers.php';
         /**
          * Include template actions and filters.
          *
          */
         require_once PRESSCORE_DIR . '/template-tags.php';
         /**
          * Include paginator.
          *
          */
         require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
         if (!class_exists('Mobile_Detect')) {
             /**
              * Mobile detection library.
              *
              */
             require_once PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php';
         }
         // get page
         query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
         $config = Presscore_Config::get_instance();
         $config->set('template', 'media');
         $config->base_init($post_id);
         if ($config->get('justified_grid') && isset($sender) && in_array($sender, array('filter', 'paginator'))) {
             $loaded_items = array();
         }
         $html = '';
         $responce = array('success' => true);
         if (have_posts() && !post_password_required()) {
             while (have_posts()) {
                 the_post();
                 // main loop
                 ob_start();
                 // presscore_post_meta_new_gallery_controller();
                 do_action('presscore_before_loop');
                 $page_query = Presscore_Inc_Albums_Post_Type::get_media_template_query();
                 if ($page_query->have_posts()) {
                     while ($page_query->have_posts()) {
                         $page_query->the_post();
                         $key_in_loaded = array_search($post->ID, $loaded_items);
                         if (false !== $key_in_loaded) {
                             unset($loaded_items[$key_in_loaded]);
                             continue;
                         }
                         get_template_part('content', 'media');
                     }
                     wp_reset_postdata();
                 }
                 $html .= ob_get_clean();
             }
             $next_page_link = dt_get_next_posts_url($page_query->max_num_pages);
             if ($next_page_link) {
                 $responce['nextPage'] = dt_get_paged_var() + 1;
             } else {
                 $responce['nextPage'] = 0;
             }
             $load_style = $config->get('load_style');
             // pagination style
             if (presscore_is_load_more_pagination()) {
                 $pagination = dt_get_next_page_button($page_query->max_num_pages, 'paginator paginator-more-button with-ajax');
                 if ($pagination) {
                     $responce['currentPage'] = dt_get_paged_var();
                     $responce['paginationHtml'] = $pagination;
                 } else {
                     $responce['currentPage'] = $post_paged;
                 }
                 $responce['paginationType'] = 'more';
             } else {
                 if ('ajax_pagination' == $load_style) {
                     ob_start();
                     dt_paginator($page_query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
                     $pagination = ob_get_clean();
                     if ($pagination) {
                         $responce['paginationHtml'] = $pagination;
                     }
                     $responce['paginationType'] = 'paginator';
                 }
             }
             $responce['itemsToDelete'] = array_values($loaded_items);
             // $responce['query'] = $page_query->query;
             $responce['order'] = $config->get('order');
             $responce['orderby'] = $config->get('orderby');
         }
         // main loop
         $responce['html'] = $html;
     }
     $responce = json_encode($responce);
     // responce output
     header("Content-Type: application/json");
     echo $responce;
     // IMPORTANT: don't forget to "exit"
     exit;
 }
Exemplo n.º 23
0
 function presscore_body_class($classes)
 {
     $config = Presscore_Config::get_instance();
     $desc_on_hoover = 'under_image' != $config->get('post.preview.description.style');
     $template = $config->get('template');
     $layout = $config->get('layout');
     ///////////////////////
     // template classes //
     ///////////////////////
     switch ($template) {
         case 'blog':
             $classes[] = 'blog';
             break;
         case 'portfolio':
             $classes[] = 'portfolio';
             break;
         case 'team':
             $classes[] = 'team';
             break;
         case 'testimonials':
             $classes[] = 'testimonials';
             break;
         case 'archive':
             $classes[] = 'archive';
             break;
         case 'search':
             $classes[] = 'search';
             break;
         case 'albums':
             $classes[] = 'albums';
             break;
         case 'media':
             $classes[] = 'media';
             break;
         case 'microsite':
             $classes[] = 'one-page-row';
             break;
     }
     /////////////////////
     // layout classes //
     /////////////////////
     switch ($layout) {
         case 'masonry':
             if ($desc_on_hoover) {
                 $classes[] = 'layout-masonry-grid';
             } else {
                 $classes[] = 'layout-masonry';
             }
             break;
         case 'grid':
             $classes[] = 'layout-grid';
             if ($desc_on_hoover) {
                 $classes[] = 'grid-text-hovers';
             }
             break;
         case 'checkerboard':
         case 'list':
         case 'right_list':
             $classes[] = 'layout-list';
             break;
     }
     ////////////////////
     // hover classes //
     ////////////////////
     if (in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team'))) {
         $classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image';
     }
     //////////////////////////////////////
     // hide dividers if content is off //
     //////////////////////////////////////
     if (in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout')) {
         $show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links');
         if (!$show_dividers) {
             $classes[] = 'description-off';
         }
     }
     /////////////////////
     // single classes //
     /////////////////////
     if (is_single()) {
         if (post_password_required() || !comments_open() && '0' == get_comments_number()) {
             $classes[] = 'no-comments';
         }
         $post_type = get_post_type();
         if ('dt_gallery' == $post_type && 'photo_scroller' == $config->get('post.media.type')) {
             $classes[] = 'photo-scroller-album';
         }
     }
     /////////////////////////////////
     // fix single portfolio class //
     /////////////////////////////////
     if (in_array('single-dt_portfolio', $classes)) {
         $key = array_search('single-dt_portfolio', $classes);
         $classes[$key] = 'single-portfolio';
     }
     ////////////////////////
     // header background //
     ////////////////////////
     if ('background' == $config->get('page_title.background.mode') || in_array($config->get('header_title'), array('fancy', 'slideshow'))) {
         switch ($config->get('header_background')) {
             case 'overlap':
                 $classes['header_background'] = 'overlap';
                 break;
             case 'transparent':
                 $classes['header_background'] = 'transparent';
                 break;
         }
         if ('disabled' == $config->get('header.transparent.background.style')) {
             $classes[] = 'disabled-transparent-bg';
         }
     }
     ///////////////////
     // header title //
     ///////////////////
     if ('fancy' == $config->get('header_title')) {
         $classes[] = 'fancy-header-on';
     } elseif ('slideshow' == $config->get('header_title')) {
         $classes[] = 'slideshow-on';
         if ('3d' == $config->get('slideshow_mode') && 'fullscreen-content' == $config->get('slideshow_3d_layout')) {
             $classes[] = 'threed-fullscreen';
         }
         if (dt_get_paged_var() > 1 && isset($classes['header_background'])) {
             unset($classes['header_background']);
         }
     } elseif (is_single() && 'disabled' == $config->get('header_title')) {
         $classes[] = 'title-off';
     }
     ///////////////////
     // hover style //
     ///////////////////
     switch ($config->get('template.images.hover.style')) {
         case 'grayscale':
             $classes[] = 'filter-grayscale-static';
             break;
         case 'gray+color':
             $classes[] = 'filter-grayscale';
             break;
         case 'blur':
             $classes[] = 'image-blur';
             break;
         case 'scale':
             $classes[] = 'scale-on-hover';
             break;
     }
     ////////////
     // boxed //
     ////////////
     if ('boxed' == $config->get('template.layout')) {
         $classes[] = 'boxed-layout';
     }
     /////////////////////
     // responsiveness //
     /////////////////////
     if (!presscore_responsive()) {
         $classes[] = 'responsive-off';
     }
     /////////////////////
     // justified grid //
     /////////////////////
     if ($config->get('justified_grid')) {
         $classes[] = 'justified-grid';
     }
     ////////////////////
     // header layout //
     ////////////////////
     if ('side' == $config->get('header.layout')) {
         switch ($config->get('header.layout.side.menu.position')) {
             case 'right':
                 $classes[] = 'header-side-right';
                 break;
             default:
                 $classes[] = 'header-side-left';
         }
     }
     //////////////////////
     // accent gradient //
     //////////////////////
     if ('gradient' == $config->get('template.accent.color.mode')) {
         $classes[] = 'accent-gradient';
     }
     //////////////////////////////
     // srcset based hd images //
     //////////////////////////////
     if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) {
         $classes[] = 'srcset-enabled';
     }
     ////////////////////
     // buttons style //
     ////////////////////
     switch ($config->get('buttons.style')) {
         case '3d':
             $classes[] = 'btn-3d';
             break;
         case 'flat':
             $classes[] = 'btn-flat';
             break;
         case 'ios7':
         default:
             $classes[] = 'btn-ios';
             break;
     }
     if ($config->get('template.footer.background.slideout_mode')) {
         $classes[] = 'footer-overlap';
     }
     /////////////////////
     // general style //
     /////////////////////
     switch ($config->get('template.style')) {
         case 'minimalistic':
             $classes[] = 'style-minimal';
             break;
         case 'ios7':
             $classes[] = 'style-ios';
             break;
     }
     /////////////////////
     // floating menu //
     /////////////////////
     if ($config->get('header.floating_menu.show')) {
         switch ($config->get('floating_menu.animation')) {
             case 'fade':
                 $classes[] = 'phantom-fade';
                 break;
             case 'slide':
                 $classes[] = 'phantom-slide';
                 break;
         }
     }
     /////////////
     // return //
     /////////////
     return array_values(array_unique($classes));
 }