function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $options['module_id'] = $this->module_id; $this->module_start($options); /* Module output stars here */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } if (!isset($options['type'])) { $options['type'] = 'grid'; } if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // Fix for pagination from other modules affecting this one when pag disabled if ($options['pagination_type'] == 'disabled') { $paged = 1; } // Fix for offset braking pagination $query_offset = $options['offset']; if ($query_offset > 0 && $paged > 1) { $query_offset = ($paged - 1) * $options['amount'] + $options['offset']; } $args = array('paged' => $paged, 'post_type' => 'dslc_projects', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $query_offset); if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'dslc_projects_cats', 'field' => 'slug', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // Author archive page if (is_author()) { global $authordata; $args['author__in'] = array($authordata->data->ID); } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Do the query if (is_category() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } $wrapper_class = ''; $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /* Container Class */ $container_class = 'dslc-posts dslc-projects dslc-clearfix dslc-posts-orientation-' . $options['orientation'] . ' '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } /* Element Class */ $element_class = 'dslc-post dslc-project '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_title']; ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_terms(get_the_ID(), 'dslc_projects_cats'); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _ex('All', 'Post Filter', 'dslc_string'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $project_cats_count = 0; $project_cats = get_the_terms(get_the_ID(), 'dslc_projects_cats'); $project_cats_data = ''; if (!empty($project_cats)) { foreach ($project_cats as $project_cat) { $project_cats_data .= $project_cat->slug . ' '; } } // Project URL $the_project_url = get_permalink(); if ($options['link'] == 'custom') { if (get_post_meta(get_the_ID(), 'dslc_project_url', true)) { $the_project_url = get_post_meta(get_the_ID(), 'dslc_project_url', true); } else { $the_project_url = '#'; } } // Project URL target $the_project_url_target = $options['link_target']; ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $project_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <?php if (has_post_thumbnail()) { ?> <div class="dslc-post-thumb dslc-project-thumb dslc-on-hover-anim"> <div class="dslc-project-thumb-inner dslca-post-thumb"> <?php if ($manual_resize) { ?> <a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><img src="<?php $res_img = dslc_aq_resize($thumb_url, $resize_width, $resize_height, true); echo $res_img; ?> " alt="<?php echo $thumb_alt; ?> " /></a> <?php } else { ?> <a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><?php the_post_thumbnail('full'); ?> </a> <?php } ?> </div><!-- .dslc-project-thumb-inner --> <?php if (($options['main_location'] == 'inside' || $options['main_location'] == 'inside_visible') && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('categories', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-project-main <?php if ($options['main_location'] == 'inside_visible') { echo 'dslc-project-main-visible'; } ?> dslc-on-hover-anim-target dslc-anim-<?php echo $options['css_anim_hover']; ?> " data-dslc-anim="<?php echo $options['css_anim_hover']; ?> " data-dslc-anim-speed="<?php echo $options['css_anim_speed']; ?> "> <div class="dslc-project-main-inner dslc-init-<?php echo $options['main_position']; ?> "> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-project-title"> <h2><a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-project-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('categories', $post_elements)) { ?> <?php if (!empty($project_cats)) { ?> <div class="dslc-project-cats"> <?php foreach ($project_cats as $project_cat) { $project_cats_count++; if ($project_cats_count > 1) { echo ', '; } echo $project_cat->name; } ?> </div><!-- .dslc-project-cats --> <?php } ?> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-project-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } ?> <?php } ?> </div><!-- .dslc-project-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-project-read-more"> <a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-project-read-more --> <?php } ?> </div><!-- .dslc-init-center --> </div><!-- .dslc-project-main --> <?php } ?> </div><!-- .dslc-project-thumb --> <?php } ?> <?php } ?> <?php if ($options['main_location'] == 'bellow' && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('categories', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-project-main"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-project-title"> <h2><a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-project-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('categories', $post_elements)) { ?> <?php if (!empty($project_cats)) { ?> <div class="dslc-project-cats"> <?php foreach ($project_cats as $project_cat) { $project_cats_count++; if ($project_cats_count > 1) { echo ', '; } echo $project_cat->name; } ?> </div><!-- .dslc-project-cats --> <?php } ?> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-project-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } ?> <?php } ?> </div><!-- .dslc-project-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-project-read-more"> <a href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-project-read-more --> <?php } ?> </div><!-- .dslc-project-main --> <?php } ?> </div><!-- .dslc-project --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!-- .dslc-projects --> <?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have any projects at the moment. Go to <strong>WP Admin → Projects</strong> to add some.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; if ($options['offset'] > 0) { $num_pages = ceil(($dslc_query->found_posts - $options['offset']) / $options['amount']); } dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_postdata(); /* Module output ends here */ $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $options['module_id'] = $this->module_id; $this->module_start($options); /* Module output stars here */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } if (!isset($options['type'])) { $options['type'] = 'grid'; } if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } $args = array('paged' => $paged, 'post_type' => 'dslc_projects', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $options['offset']); if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'dslc_projects_cats', 'field' => 'slug', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // Author archive page if (is_author()) { global $authordata; $args['author__in'] = array($authordata->data->ID); } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Do the query if (is_category() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } $wrapper_class = ''; $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /* Container Class */ $container_class = 'dslc-posts dslc-projects dslc-clearfix '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } $container_class .= " as-isotope-posts"; /* Element Class */ $element_class = 'dslc-post dslc-project '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } ?> <?php if ($options['as_ajax_projects'] == 1 && $options['as_ajax_projects_position'] == 'top') { ?> <!-- PRINT PROJECTS DATA --> <div id="as_portfolio_content" style="display:none;"> <div class="as-wrapper clearfix"> <div class="as-portfolio-ajax-wrapper"> <div class="as-port-control dslc-col dslc-12-col dslc-last-col"> <a href="javascript:void(0);" class="prev" data-ajax="1" data-id="59"> <span class="dslc-icon dslc-icon-angle-left"></span><span class="as-btn-text-ajax-prj"><?php _e('Prev', 'as'); ?> </span> </a> <a href="javascript:void(0);" class="close-port"> <span class="dslc-icon dslc-icon-remove"></span> </a> <a href="javascript:void(0);" class="next" data-ajax="1" data-id="57"> <span class="as-btn-text-ajax-prj"><?php _e('Next', 'as'); ?> </span><span class="dslc-icon dslc-icon-angle-right"></span> </a> </div> </div> <div class="as-port-content"> </div> </div> </div> <div class="clearfix"></div> <!-- PRINT PROJECTS DATA / END --> <?php } ?> <?php /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_title']; ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_terms(get_the_ID(), 'dslc_projects_cats'); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter as-isotope-filter dslc-active" data-id=" "><?php _e('All', 'Post Filter', 'dslc_string'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter as-isotope-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "> <?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $project_cats_count = 0; $project_cats = get_the_terms(get_the_ID(), 'dslc_projects_cats'); $project_cats_data = ''; if (!empty($project_cats)) { foreach ($project_cats as $project_cat) { $project_cats_data .= $project_cat->slug . ' '; } } // Project URL $the_project_url = get_permalink(); if ($options['link'] == 'custom') { if (get_post_meta(get_the_ID(), 'dslc_project_url', true)) { $the_project_url = get_post_meta(get_the_ID(), 'dslc_project_url', true); } else { $the_project_url = '#'; } } // Project URL target $the_project_url_target = $options['link_target']; ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> <?php echo $project_cats_data; ?> " data-cats="<?php echo $project_cats_data; ?> "> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <?php if (has_post_thumbnail()) { ?> <?php $anchor_class = 'dslc-lightbox-image'; $duration_hover = ''; $value_duration = $options['css_main_bg_color_duration_hover']; if ($value_duration != '') { $duration_hover = 'style="-webkit-transition: all ' . $value_duration . 'ms ease-out;-moz-transition: all ' . $value_duration . 'ms ease-out;-ms-transition: all ' . $value_duration . 'ms ease-out;-o-transition: all ' . $value_duration . 'ms ease-out;transition: all ' . $value_duration . 'ms ease-out;"'; } ?> <div class="dslc-post-thumb dslc-project-thumb dslc-on-hover-anim as-project-custom"> <div class="dslc-project-thumb-inner dslca-post-thumb"> <?php if ($manual_resize) { ?> <a data-id="<?php echo get_the_ID(); ?> " data-ajax="<?php echo isset($options['as_ajax_projects']) && $options['as_ajax_projects'] ? '1' : '0'; ?> " href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><img src="<?php $res_img = dslc_aq_resize($thumb_url, $resize_width, $resize_height, true); echo $res_img; ?> " alt="<?php echo $thumb_alt; ?> " /></a> <?php } else { ?> <a data-id="<?php echo get_the_ID(); ?> " data-ajax="<?php echo isset($options['as_ajax_projects']) && $options['as_ajax_projects'] ? '1' : '0'; ?> " href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><?php the_post_thumbnail('full'); ?> </a> <?php } ?> </div><!-- .dslc-project-thumb-inner --> <?php if ($post_elements == 'all' || in_array('title', $post_elements) || in_array('categories', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements)) { ?> <div class="dslc-project-main dslc-on-hover-anim-target" <?php echo $duration_hover; ?> > <div class="dslc-project-main-inner"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-project-title"> <h2><a data-ajax="<?php echo isset($options['as_ajax_projects']) && $options['as_ajax_projects'] ? '1' : '0'; ?> " data-id="<?php echo get_the_ID(); ?> " href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-project-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('categories', $post_elements)) { ?> <?php if (!empty($project_cats)) { ?> <div class="dslc-project-cats"> <?php foreach ($project_cats as $project_cat) { $project_cats_count++; if ($project_cats_count > 1) { echo ', '; } echo $project_cat->name; } ?> </div><!-- .dslc-project-cats --> <?php } ?> <?php } ?> <div class="as-project-line"></div> <?php if ($post_elements == 'all' || in_array('icon_link', $post_elements)) { ?> <div class="as-group-icon-project"> <?php $img_link_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $img_link_url = $img_link_url[0]; ?> <a class="as-zoom-img-project as-lightbox-gallery" href="<?php echo esc_url($img_link_url); ?> "><span class="dslc-icon dslc-icon-search"></span></a> <a class="as-link-to-project" data-ajax="<?php echo isset($options['as_ajax_projects']) && $options['as_ajax_projects'] ? '1' : '0'; ?> " data-id="<?php echo get_the_ID(); ?> " href="<?php echo $the_project_url; ?> " target="<?php echo $the_project_url_target; ?> "><span class="dslc-icon dslc-icon-link"></span></a> </div> <?php } ?> </div><!-- .dslc-init-center --> </div><!-- .dslc-project-main --> <?php } ?> </div><!-- .dslc-project-thumb --> <?php } ?> </div><!-- .dslc-project --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!-- .dslc-projects --> <?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have any projects at the moment. Go to <strong>WP Admin → Projects</strong> to add some.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_query(); ?> <?php if ($options['as_ajax_projects'] == 1 && $options['as_ajax_projects_position'] == 'bottom') { ?> <!-- PRINT PROJECTS DATA --> <div id="as_portfolio_content" style="display:none;"> <div class="as-wrapper clearfix"> <div class="as-portfolio-ajax-wrapper"> <div class="as-port-control dslc-col dslc-12-col dslc-last-col"> <a href="javascript:void(0);" class="prev" data-ajax="1" data-id="59"> <span class="dslc-icon dslc-icon-angle-left"></span><span class="as-btn-text-ajax-prj"><?php _e('Prev', 'as'); ?> </span> </a> <a href="javascript:void(0);" class="close-port"> <span class="dslc-icon dslc-icon-remove"></span> </a> <a href="javascript:void(0);" class="next" data-ajax="1" data-id="57"> <span class="as-btn-text-ajax-prj"><?php _e('Next', 'as'); ?> </span><span class="dslc-icon dslc-icon-angle-right"></span> </a> </div> </div> <div class="as-port-content"> </div> </div> </div> <div class="clearfix"></div> <!-- PRINT PROJECTS DATA / END --> <?php } ?> <?php /* Module output ends here */ $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $this->module_start($options); /* Module output stars here */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } if (!isset($options['type'])) { $options['type'] = 'grid'; } if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // Fix for pagination from other modules affecting this one when pag disabled if ($options['pagination_type'] == 'disabled') { $paged = 1; } // Fix for offset braking pagination $query_offset = $options['offset']; if ($query_offset > 0 && $paged > 1) { $query_offset = ($paged - 1) * $options['amount'] + $options['offset']; } $args = array('paged' => $paged, 'post_type' => 'dslc_testimonials', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby']); // Add offset if ($query_offset > 0) { $args['offset'] = $query_offset; } if (defined('DOING_AJAX') && DOING_AJAX) { $args['post_status'] = array('publish', 'private'); } if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'dslc_testimonials_cats', 'field' => 'slug', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } $dslc_query = new WP_Query($args); $wrapper_class = ''; $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /* Container Class */ $container_class = 'dslc-posts dslc-testimonials dslc-clearfix '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } /* Element Class */ $element_class = 'dslc-post dslc-testimonial '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } // Responsive //$element_class .= 'dslc-res-sm-' . $options['res_sm_columns'] . ' '; //$element_class .= 'dslc-res-tp-' . $options['res_tp_columns'] . ' '; /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo stripslashes($options['main_heading_title']); ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_terms(get_the_ID(), 'dslc_testimonials_cats'); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _ex('All', 'Post Filter', 'live-composer-page-builder'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php ?> <div class="dslc-posts-inner"><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } $post_cats_count = 0; $post_cats = get_the_terms(get_the_ID(), 'dslc_testimonials_cats'); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <?php ob_start(); ?> <div class="dslc-testimonial-author dslc-testimonial-author-pos-<?php echo str_replace(' ', '-', $options['author_pos']); ?> dslc-clearfix"> <?php if ($post_elements == 'all' || in_array('avatar', $post_elements)) { ?> <div class="dslc-testimonial-author-avatar"> <?php the_post_thumbnail('full'); ?> </div><!-- .dslc-testimonial-author-avatar --> <?php } ?> <div class="dslc-testimonial-author-main"> <?php if ($post_elements == 'all' || in_array('name', $post_elements)) { ?> <div class="dslc-testimonial-author-name"> <?php the_title(); ?> </div><!-- .dslc-testimonial-author-name --> <?php } ?> <?php if ($post_elements == 'all' || in_array('position', $post_elements)) { ?> <div class="dslc-testimonial-author-position"> <?php echo get_post_meta(get_the_ID(), 'dslc_testimonial_author_pos', true); ?> </div><!-- .dslc-testimoniala-author-position --> <?php } ?> </div><!-- .dslc-testimonial-author-main --> </div><!-- .dslc-testimonial-author --> <?php $author_output = ob_get_contents(); ob_end_clean(); ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <div class="dslc-testimonial-inner"> <?php if ($options['author_pos'] == 'outside top' || $options['author_pos'] == 'outside left' || $options['author_pos'] == 'outside right') { echo $author_output; } ?> <div class="dslc-testimonial-main"> <?php if ($options['author_pos'] == 'inside top') { echo $author_output; } ?> <?php if ($post_elements == 'all' || in_array('quote', $post_elements)) { ?> <div class="dslc-testimonial-quote"> <?php echo do_shortcode(get_the_content()); ?> </div><!-- .dslc-testimonial-quote --> <?php } ?> <?php if ($options['author_pos'] == 'inside bottom') { echo $author_output; } ?> </div><!-- .dslc-testimonial-main --> <?php if ($options['author_pos'] == 'outside bottom') { echo $author_output; } ?> </div><!-- .dslc-testimonial-inner --> </div><!-- .dslc-testimonial --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount']) { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!-- .dslc-posts-inner --> </div><!-- .dslc-testimonials --> <?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have any testimonials at the moment. Go to <strong>WP Admin → Testimonials</strong> to add some.', 'live-composer-page-builder'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; if ($options['offset'] > 0) { $num_pages = ceil(($dslc_query->found_posts - $options['offset']) / $options['amount']); } dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_postdata(); /* Module output ends here */ $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } // Fix slashes on apostrophes if (isset($options['button_text'])) { $options['button_text'] = stripslashes($options['button_text']); } $this->module_start($options); /* CUSTOM START */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } /** * Query */ // Fix for pagination if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // Fix for pagination from other modules affecting this one when pag disabled if ($options['pagination_type'] == 'disabled') { $paged = 1; } // Fix for offset braking pagination $query_offset = $options['offset']; if ($query_offset > 0 && $paged > 1) { $query_offset = ($paged - 1) * $options['amount'] + $options['offset']; } // General args $args = array('paged' => $paged, 'post_type' => 'post', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $query_offset); if (defined('DOING_AJAX') && DOING_AJAX) { $args['post_status'] = array('publish', 'private'); } // Category args if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'term_id', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // Author archive page if (is_author()) { global $authordata; $args['author__in'] = array($authordata->data->ID); } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Do the query if (is_category() || is_tag() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } /** * Unnamed */ $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /** * Classes generation */ // Posts container $container_class = 'dslc-posts dslc-blog-posts dslc-clearfix dslc-blog-posts-type-' . $options['type'] . ' dslc-posts-orientation-' . $options['orientation'] . ' '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } // Post $element_class = 'dslc-post dslc-blog-post '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo stripslashes($options['main_heading_title']); ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_category(get_the_ID()); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _ex('All', 'Post Filter', 'live-composer-page-builder'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php ?> <div class="dslc-posts-inner"><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; if (!is_sticky()) { $real_count++; } if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } // Post Format Class $post_format = get_post_format(); if (false === $post_format) { $post_format = 'standard'; } $extra_class .= ' dslc-post-format-' . $post_format; $post_cats = get_the_category(get_the_ID()); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <?php if (has_post_thumbnail()) { ?> <div class="dslc-blog-post-thumb dslc-post-thumb dslc-on-hover-anim"> <div class="dslc-blog-post-thumb-inner dslca-post-thumb"> <?php if ($manual_resize) { ?> <a href="<?php the_permalink(); ?> "><img src="<?php $res_img = dslc_aq_resize($thumb_url, $resize_width, $resize_height, true); echo $res_img; ?> " alt="<?php echo $thumb_alt; ?> " /></a> <?php } else { ?> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('full'); ?> </a> <?php } ?> </div><!-- .dslc-blog-post-thumb-inner --> <?php if (($options['main_location'] == 'inside' || $options['main_location'] == 'inside_visible') && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('meta', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-blog-post-main <?php if ($options['main_location'] == 'inside_visible') { echo 'dslc-blog-post-main-visible'; } ?> dslc-on-hover-anim-target dslc-anim-<?php echo $options['css_anim_hover']; ?> " data-dslc-anim="<?php echo $options['css_anim_hover']; ?> " data-dslc-anim-speed="<?php echo $options['css_anim_speed']; ?> "> <div class="dslc-blog-post-main-inner dslc-init-<?php echo $options['main_position']; ?> "> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-blog-post-title"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-blog-post-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('meta', $post_elements)) { ?> <?php // Meta Elements $meta_elements = $options['meta_elements']; $meta_elements = explode(' ', trim($meta_elements)); ?> <div class="dslc-blog-post-meta"> <?php if (in_array('author', $meta_elements)) { ?> <div class="dslc-blog-post-meta-author"> <?php _e('By', 'live-composer-page-builder'); ?> <?php the_author_posts_link(); ?> </div><!-- .dslc-blog-post-meta-author --> <?php } ?> <?php if (in_array('author', $meta_elements)) { ?> <div class="dslc-blog-post-meta-date"> <?php the_time(get_option('date_format')); ?> </div><!-- .dslc-blog-post-meta-date --> <?php } ?> </div><!-- .dslc-blog-post-meta --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-blog-post-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if ($options['excerpt_length'] > 0) { if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } } else { if (has_excerpt()) { echo do_shortcode(get_the_excerpt()); } else { echo do_shortcode(get_the_content()); } } ?> <?php } ?> </div><!-- .dslc-blog-post-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-blog-post-read-more"> <a href="<?php the_permalink(); ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-blog-post-read-more --> <?php } ?> </div><!-- .blog-post-main-inner --> <a href="<?php the_permalink(); ?> " class="dslc-post-main-inner-link-cover"></a> </div><!-- .blog-post-main --> <?php } ?> </div><!-- .dslc-blog-post-thumb --> <?php } ?> <?php } ?> <?php if ($options['main_location'] == 'bellow' && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('meta', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-blog-post-main"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-blog-post-title"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-blog-post-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('meta', $post_elements)) { ?> <?php // Meta Elements $meta_elements = $options['meta_elements']; $meta_elements = explode(' ', trim($meta_elements)); ?> <div class="dslc-blog-post-meta"> <?php if (in_array('author', $meta_elements)) { ?> <div class="dslc-blog-post-meta-author"> <span class="dslc-blog-post-meta-avatar"> <?php echo get_avatar(get_the_author_meta('ID'), 100); ?> </span> <?php _e('By', 'live-composer-page-builder'); ?> <?php the_author_posts_link(); ?> </div><!-- .dslc-blog-post-meta-author --> <?php } ?> <?php if (in_array('date', $meta_elements)) { ?> <div class="dslc-blog-post-meta-date"> <?php the_time(get_option('date_format')); ?> </div><!-- .dslc-blog-post-meta-date --> <?php } ?> </div><!-- .dslc-blog-post-meta --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-blog-post-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if ($options['excerpt_length'] > 0) { if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } } else { if (has_excerpt()) { echo do_shortcode(get_the_excerpt()); } else { echo do_shortcode(get_the_content()); } } ?> <?php } ?> </div><!-- .dslc-blog-post-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-blog-post-read-more"> <a href="<?php the_permalink(); ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-blog-post-read-more --> <?php } ?> </div><!-- .blog-post-main --> <?php if ($post_elements == 'all' || in_array('social', $post_elements)) { ?> <?php $share_info = dslc_get_social_count(); ?> <div class="dslc-posts-social-share"> <?php $post_img = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); ?> <?php $share_status = esc_attr(get_the_title(get_the_ID()) . ' ' . get_permalink(get_the_ID())); ?> <a href="#" target="_blank" onClick="return dslc_social_share(400, 300, 'http://www.facebook.com/share.php?u=<?php echo get_permalink(get_the_ID()); ?> ')"><span class="dslc-icon dslc-icon-facebook"></span><span class="dslc-posts-social-share-count"><?php if ($share_info) { echo esc_html($share_info['fb']); } ?> </span></a> <a href="#" onClick="return dslc_social_share(400, 300, 'https://twitter.com/home?status=<?php echo $share_status; ?> ')" ><span class="dslc-icon dslc-icon-twitter"></span><span class="dslc-posts-social-share-count"><?php if ($share_info) { echo esc_html($share_info['twitter']); } ?> </span></a> <a href="#" onClick="return dslc_social_share(400, 300, 'https://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?> &media=<?php echo esc_html($post_img); ?> &description=<?php echo esc_attr(get_the_excerpt()); ?> ')"><span class="dslc-icon dslc-icon-pinterest"></span><span class="dslc-posts-social-share-count"><?php if ($share_info) { echo esc_html($share_info['pinterest']); } ?> </span></a> </div><!-- .dslc-posts-social-share --> <?php } ?> <?php } ?> </div><!-- .dslc-blog-post --> <?php do_action('dslc_blog_module_after_post', $real_count); ?> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!-- .dslc-posts-inner --><?php ?> </div><!-- .dslc-blog-posts --><?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have any blog posts at the moment. Go to <strong>WP Admin → Posts</strong> to add some.', 'live-composer-page-builder'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; if ($options['offset'] > 0) { $num_pages = ceil(($dslc_query->found_posts - $options['offset']) / $options['amount']); } dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_postdata(); $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $this->module_start($options); /* CUSTOM START */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } /** * Query */ // Fix for pagination if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // General args $args = array('paged' => $paged, 'post_type' => $options['post_type'], 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $options['offset']); // Category args if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', $options['categories']); $args['category__in'] = $cats_array; } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // Author archive page if (is_author()) { global $authordata; $args['author__in'] = array($authordata->data->ID); } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Do the query if (is_category() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } /** * Duration when hover link */ $duration_hover = ''; $value_duration = $options['as_duration_hover']; if ($value_duration != '') { $duration_hover = ' <style> #dslc-module-' . $options['module_instance_id'] . ' .dslc-cpt-post-title h2 a, #dslc-module-' . $options['module_instance_id'] . ' .dslc-cpt-post-meta a, #dslc-module-' . $options['module_instance_id'] . ' .dslc-cpt-post-read-more a, #dslc-module-' . $options['module_instance_id'] . ' a.as-post-like .dslc-icon{ -webkit-transition: all ' . $value_duration . 'ms ease; -moz-transition: all ' . $value_duration . 'ms ease; -ms-transition: all ' . $value_duration . 'ms ease; -o-transition: all ' . $value_duration . 'ms ease; transition: all ' . $value_duration . 'ms ease; </style> '; } /** * Unnamed */ $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /** * Classes generation */ // Posts container $container_class = 'dslc-posts dslc-cpt-posts dslc-clearfix dslc-cpt-posts-type-' . $options['type'] . ' dslc-posts-orientation-' . $options['orientation'] . ' '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } // Post $element_class = 'dslc-post dslc-cpt-post '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_title']; ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_category(get_the_ID()); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _e('All', 'Post Filter', 'dslc_string'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ global $post; if ($dslc_query->have_posts()) { ?> <?php echo $duration_hover; ?> <div class="as-custom-post-class <?php echo $container_class; ?> "><?php ?> <div class="dslc-posts-inner"><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $post_cats = get_the_category(get_the_ID()); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <!-- post format --> <?php define('AS_LIVE_COMPOSER_ABS', dirname(__FILE__)); $format = get_post_format(); get_template_part('plugins/ds-live-composer/as_custom/modules/as-posts-2/format/content', $format); ?> <!-- post format --> <?php } ?> <?php if ($options['main_location'] == 'bellow' && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('meta', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-cpt-post-main"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-cpt-post-title"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-cpt-post-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('meta', $post_elements)) { ?> <div class="dslc-cpt-post-meta"> <div class="dslc-cpt-post-meta-date"> <?php the_time(get_option('date_format')); ?> </div><!-- .dslc-cpt-post-meta-date --> <span class="as-circle-line-post"></span> <div class="dslc-cpt-post-meta-author"> <?php _e('by', 'dslc_string'); ?> <?php the_author_posts_link(); ?> </div><!-- .dslc-cpt-post-meta-author --> <span class="as-circle-line-post"></span> <div class="dslc-cpt-post-meta-category"> <?php _e('in', 'dslc_string'); ?> <?php the_category(', '); ?> </div><!-- .dslc-cpt-post-meta-category --> </div><!-- .dslc-cpt-post-meta --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-cpt-post-excerpt"> <?php if (isset($format) && empty($format)) { ?> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } ?> <?php } ?> <?php } ?> </div><!-- .dslc-cpt-post-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-cpt-post-read-more"> <a href="<?php the_permalink(); ?> " class="as-btn-read-more"> <?php if ($options['as_button_position_icon'] == 'left') { ?> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php } ?> <?php echo $options['button_text']; ?> <?php if ($options['as_button_position_icon'] == 'right') { ?> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php } ?> </a> <div class="as-post-like-share"> <div class="as-btn-heart-blog"> <a href="#" class="as-post-like <?php echo as_is_like_post($post->ID); ?> " data-id="<?php echo $post->ID; ?> "> <span class="dslc-icon dslc-icon-heart"></span> <span class="number-like-heart"> <?php echo get_post_meta($post->ID, 'as_like_count', true) ? get_post_meta($post->ID, 'as_like_count', true) : 0; ?> </span> </a> </div> <!-- <div class="as-btn-share-social-blog"> <span class="dslc-icon dslc-icon-share"></span> <ul class="as-list-icon-share"> <li> <a class="as-share-blog-twitter" href="http://twitter.com/share?url=<?php the_permalink(); ?> &lang=en&text=Check out this awesome project:&" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=620');return false;" data-count="none" data-via=" "> <span class="dslc-icon dslc-icon-twitter"></span> </a> <a class="sb-facebook" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?> " onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=660');return false;" target="_blank"> <span class="dslc-icon dslc-icon-facebook"></span> </a> <a class="sb-google" href="https://plus.google.com/share?url=<?php the_permalink(); ?> &title=<?php wp_title(''); ?> " onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=500');return false;"> <span class="dslc-icon dslc-icon-google-plus"></span> </a> </li> </ul> </div> --> </div> </div><!-- .dslc-cpt-post-read-more --> <?php } ?> </div><!-- .dslc-cpt-post-main --> <?php } ?> </div><!-- .dslc-cpt-post --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!--.dslc-posts-inner --><?php ?> </div><!-- .dslc-cpt-posts --><?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have any posts of that post type at the moment.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_query(); $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $this->module_start($options); if (!isset($options['price_pos'])) { $options['price_pos'] = 'center'; } if (class_exists('Woocommerce')) { /* Module output stars here */ if ($options['orderby'] == 'price') { $options['orderby'] = 'meta_value_num'; $orderby = 'price'; } if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // Fix for pagination from other modules affecting this one when pag disabled if ($options['pagination_type'] == 'disabled') { $paged = 1; } // Fix for offset braking pagination $query_offset = $options['offset']; if ($query_offset > 0 && $paged > 1) { $query_offset = ($paged - 1) * $options['amount'] + $options['offset']; } $args = array('paged' => $paged, 'post_type' => 'product', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $query_offset); if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } if (isset($orderby) && $orderby == 'price') { $args['meta_key'] = '_price'; } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // Author archive page if (is_author()) { global $authordata; $args['author__in'] = array($authordata->data->ID); } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Out of stock ( show/hide ) if ($options['outofstock'] == 'disabled') { $args['meta_query'] = array(array('key' => '_stock_status', 'value' => 'outofstock', 'compare' => '!=')); } // Do the query if (is_category() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /* Container Class */ $container_class = ' dslc-posts dslc-products dslc-clearfix dslc-products-type-' . $options['type'] . ' dslc-posts-orientation-' . $options['orientation'] . ' '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } /* Element Class */ $element_class = 'as-product-customize dslc-post dslc-product '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } // Responsive //$element_class .= 'dslc-res-sm-' . $options['res_sm_columns'] . ' '; //$element_class .= 'dslc-res-tp-' . $options['res_tp_columns'] . ' '; /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo stripslashes($options['main_heading_title']); ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_terms(get_the_ID(), 'product_cat'); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _ex('All', 'Post Filter', 'dslc_string'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; global $product; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $post_cats = get_the_terms(get_the_ID(), 'product_cat'); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php if (has_post_thumbnail()) { ?> <div class="dslc-post-thumb dslc-product-thumb dslc-on-hover-anim"> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <div class="dslc-product-thumb-inner dslca-post-thumb"> <div class="product_listing_buttons_wrapper"> <div class="product_listing_buttons"> <?php $text_addtocart = __('Add to cart', AS_DOMAIN); $text_wishlist = __('Wishlist', AS_DOMAIN); $text_compare = __('Compare', AS_DOMAIN); $text_quickview = __('Quick View', AS_DOMAIN); echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button as_button as_buy_btn %s product_type_%s"><span class="dslc-icon dslc-icon-shopping-cart"></span><span class="as-loading-woo-img"></span><div class="as-tooltip-button-woo">' . $text_addtocart . '</div></a>', $product->add_to_cart_url(), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', esc_attr($product->product_type), esc_html($product->add_to_cart_text())), $product); echo '<a data-product-id="' . $product->id . '" class="button as_button product_show_detail_button as_wishlist_btn" href="javascript:;"><span class="dslc-icon dslc-icon-heart-empty"></span><div class="as-tooltip-button-woo">' . $text_wishlist . '</div></a>'; echo '<a data-product-id="' . $product->id . '" class="button as_button product_show_detail_button as_compare_btn" href="javascript:;"><span class="dslc-icon dslc-icon-retweet"></span><div class="as-tooltip-button-woo">' . $text_compare . '</div></a>'; echo '<a data-product-id="' . $product->id . '" data-effect="mfp-zoom-in" data-ajax-url="' . admin_url("admin-ajax.php") . '" class="button as_button product_show_detail_button as_quickview_btn" href="#as-product-quickview"><span class="dslc-icon dslc-icon-eye-open"></span><div class="as-tooltip-button-woo">' . $text_quickview . '</div></a>'; ?> <!-- <a class="testpop" href="#test-popup" data-effect="mfp-zoom-in">Zoom</a> <div id="test-popup" class="white-popup mfp-with-anim mfp-hide">You may put any HTML here. This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.</div> --> <div class="clearfix"></div> </div> </div> <a href="<?php the_permalink(); ?> "><?php do_action("woocommerce_before_shop_loop_item_title"); ?> </a> </div><!-- .dslc-product-thumb-inner --> </div><!-- .dslc-product-thumb --> <?php } ?> <?php } ?> <?php if ($post_elements == 'all' || in_array('title', $post_elements) || in_array('separator', $post_elements) || in_array('addtocart', $post_elements) || in_array('details', $post_elements)) { ?> <div class="dslc-post-main dslc-product-main woocommerce"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-product-title dslc-clearfix"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-product-title --> <?php } ?> <!-- Pricing --> <?php if ($post_elements == 'all' || in_array('price_2', $post_elements)) { ?> <div class="dslc-product-price-secondary"><?php echo $product->get_price_html(); ?> </div> <?php } ?> <!-- Rating --> <?php $rating_count = $product->get_rating_count(); $review_count = $product->get_review_count(); $average = $product->get_average_rating(); if ($rating_count > 0) { ?> <div class="woocommerce-product-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <div class="star-rating" title="<?php printf(__('Rated %s out of 5', 'woocommerce'), $average); ?> "> <span style="width:<?php echo $average / 5 * 100; ?> %"></span> </div> </div> <?php } ?> <?php if ($post_elements == 'all' || in_array('separator', $post_elements)) { ?> <span class="dslc-product-sep"></span> <?php } ?> <div class="dslc-product-extra dslc-clearfix"> <?php if ($post_elements == 'all' || in_array('addtocart', $post_elements)) { ?> <a href="<?php echo do_shortcode('[add_to_cart_url id="' . get_the_ID() . '"]'); ?> " class="dslc-product-add-to-cart"><span class="dslc-icon dslc-icon-shopping-cart"></span><?php echo $options['addtocart_text']; ?> </a> <?php } ?> <?php if ($post_elements == 'all' || in_array('details', $post_elements)) { ?> <a href="<?php the_permalink(); ?> " class="dslc-product-details"><span class="dslc-icon dslc-icon-file-text"></span><?php echo $options['details_text']; ?> </a> <?php } ?> </div><!-- .dslc-product-extra --> </div><!-- .dslc-product-main --> <?php } ?> </div><!-- .dslc-product --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have products at the moment. Go to <strong>WP Admin → Products</strong> to add some.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have WooCommerce installed at the moment. You need to install it to use this module.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; if ($options['offset'] > 0) { $num_pages = ceil(($dslc_query->found_posts - $options['offset']) / $options['amount']); } dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_postdata(); /* Module output ends here */ $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $this->module_start($options); /* CUSTOM START */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } /** * Query */ // Fix for pagination if (is_front_page() && get_option('page_on_front', 0) != 0) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // General args $args = array('paged' => $paged, 'post_type' => explode(' ', trim($options['post_type'])), 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $options['offset']); /** * ---------------------------------------------------------------------- * Lumberman Extension START */ // Prepare WP_Query argument for search listing if (is_search()) { $args['s'] = get_query_var('s'); global $posttypes_to_search; $posttypes_to_search = $args['post_type']; } // Prepare WP_Query argument for archive listing if (is_archive()) { if (is_category()) { $args['cat'] = get_query_var('cat'); } elseif (is_tag()) { $args['tag_id'] = get_query_var('tag_id'); } elseif (is_author()) { $args['author'] = get_query_var('author'); } elseif (is_date()) { $args['m'] = get_query_var('m'); } } // Custom posts per page doesn't work outofthebox, // so use global settings $args['posts_per_page'] = $options['amount'] = get_option('posts_per_page'); // Time based archive pages are available only for standard posts if (is_date() || is_front_page()) { $args['post_type'] = array('post'); } // else { // Get all registered (not searchable content types) // $registered_post_types = get_post_types( array('public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false )); // Remove some custom types to not display // unset($registered_post_types['dslc_templates']); // Add WP_Query argument to search across all the post types // $args['post_type'] = array_values( $registered_post_types ); // } /** * ---------------------------------------------------------------------- */ // Category args if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', $options['categories']); $args['category__in'] = $cats_array; } // Debug: // lbmn_debug_console( $args ); // Do the query $dslc_query = new WP_Query($args); // Debug: // echo $GLOBALS['wp_query']->request; // $customPosts = new WP_Query($yourArgs); // echo "Last SQL-Query: {$dslc_query->request}"; /** * Unnamed */ $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Main Elements $elements = $options['elements']; if (!empty($elements)) { $elements = explode(' ', trim($elements)); } else { $elements = array(); } // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /** * Classes generation */ // Posts container $container_class = 'dslc-posts dslc-cpt-posts dslc-clearfix dslc-cpt-posts-type-' . $options['type'] . ' dslc-posts-orientation-' . $options['orientation'] . ' '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } // Post $element_class = 'dslc-post dslc-cpt-post '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * What is shown */ $show_header = false; $show_heading = false; $show_filters = false; $show_carousel_arrows = false; $show_view_all_link = false; if (in_array('main_heading', $elements)) { $show_heading = true; } if (($elements == 'all' || in_array('filters', $elements)) && $options['type'] !== 'carousel') { $show_filters = true; } if ($options['type'] == 'carousel' && in_array('arrows', $carousel_elements)) { $show_carousel_arrows = true; } if ($show_heading || $show_filters || $show_carousel_arrows) { $show_header = true; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Heading ( output ) */ if ($show_header) { ?> <div class="dslc-module-heading"> <!-- Heading --> <?php if ($show_heading) { ?> <h2 class="dslca-editable-content" data-id="main_heading_title" data-type="simple" <?php /* if ( $dslc_is_admin ) echo 'contenteditable'; */ ?> > <?php if ($dslc_is_admin) { echo __('This heading will be automatically generated by a theme', 'lbmn'); } elseif (is_category()) { printf(__('Category Archives: %s', 'lbmn'), '<span>' . single_cat_title('', false) . '</span>'); } elseif (is_tag()) { printf(__('Tag Archives: %s', 'lbmn'), '<span>' . single_tag_title('', false) . '</span>'); } elseif (is_author()) { /* Queue the first post, that way we know * what author we're dealing with (if that is the case). */ the_post(); printf(__('Author Archives: %s', 'lbmn'), '<span class="vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a></span>'); /* Since we called the_post() above, we need to * rewind the loop back to the beginning that way * we can run the loop properly, in full. */ rewind_posts(); } elseif (is_day()) { printf(__('Daily Archives: %s', 'lbmn'), '<span>' . get_the_date() . '</span>'); } elseif (is_month()) { printf(__('Monthly Archives: %s', 'lbmn'), '<span>' . get_the_date('F Y') . '</span>'); } elseif (is_year()) { printf(__('Yearly Archives: %s', 'lbmn'), '<span>' . get_the_date('Y') . '</span>'); } elseif (is_tax('post_format', 'post-format-aside')) { _e('Asides', 'lbmn'); } elseif (is_tax('post_format', 'post-format-image')) { _e('Images', 'lbmn'); } elseif (is_tax('post_format', 'post-format-video')) { _e('Videos', 'lbmn'); } elseif (is_tax('post_format', 'post-format-quote')) { _e('Quotes', 'lbmn'); } elseif (is_tax('post_format', 'post-format-link')) { _e('Links', 'lbmn'); } elseif (is_search()) { // special title for search result page // get number of posts found for search query // $newSearch = new WP_Query("s=$s & showposts=-1"); $search_results_count = $dslc_query->found_posts; _e('You are searching for: ', 'lbmn'); echo '<strong>' . get_query_var('s') . '</strong>. <br />'; if (1 == $search_results_count) { _e('There is one post that match your criteria...', 'lbmn'); } elseif (1 < $search_results_count) { printf(__('Here are %s posts that match your criteria...', 'lbmn'), '<span>' . $search_results_count . '</span>'); } else { _e('Looks like nothing was found. Sorry.', 'lbmn') . $search_results_count; } } elseif (is_front_page()) { echo get_bloginfo('description'); } else { _e('Archives', 'lbmn'); } // echo $options['main_heading_title']; ?> </h2> <!-- View all --> <?php if (isset($options['view_all_link']) && $options['view_all_link'] !== '') { ?> <span class="dslc-module-heading-view-all"><a href="<?php echo $options['view_all_link']; ?> " class="dslca-editable-content" data-id="main_heading_link_title" data-type="simple" <?php if ($dslc_is_admin) { echo 'contenteditable'; } ?> ><?php echo $options['main_heading_link_title']; ?> </a></span> <?php } ?> <?php } ?> <!-- Filters --> <?php if ($show_filters) { $cats_array = array(); if ($dslc_query->have_posts()) { while ($dslc_query->have_posts()) { $dslc_query->the_post(); $post_cats = get_the_category(get_the_ID()); if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $cats_array[$post_cat->slug] = $post_cat->name; } } } } ?> <div class="dslc-post-filters"> <span class="dslc-post-filter dslc-active" data-id=" "><?php _e('All', 'Post Filter', 'dslc_string'); ?> </span> <?php foreach ($cats_array as $cat_slug => $cat_name) { ?> <span class="dslc-post-filter dslc-inactive" data-id="<?php echo $cat_slug; ?> "><?php echo $cat_name; ?> </span> <?php } ?> </div><!-- .dslc-post-filters --> <?php } ?> <!-- Carousel --> <?php if ($show_carousel_arrows) { ?> <span class="dslc-carousel-nav fr"> <span class="dslc-carousel-nav-inner"> <a href="#" class="dslc-carousel-nav-prev"><span class="dslc-icon-chevron-left dslc-init-center"></span></a> <a href="#" class="dslc-carousel-nav-next"><span class="dslc-icon-chevron-right dslc-init-center"></span></a> </span> </span><!-- .carousel-nav --> <?php } ?> </div><!-- .dslc-module-heading --> <?php } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php ?> <div class="dslc-posts-inner"><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $post_cats = get_the_category(get_the_ID()); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <div class="dslc-post-thumb dslc-cpt-post-thumb dslc-on-hover-anim"> <div class="dslc-cpt-post-thumb-inner dslca-post-thumb"> <?php if ($manual_resize) { ?> <a href="<?php the_permalink(); ?> "><img src="<?php $res_img = dslc_aq_resize($thumb_url, $resize_width, $resize_height, true); echo $res_img; ?> " /></a> <?php } else { ?> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('full'); ?> </a> <?php } ?> </div><!-- .dslc-cpt-post-thumb-inner --> <?php if (($options['main_location'] == 'inside' || $options['main_location'] == 'inside_visible') && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('meta', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-cpt-post-main <?php if ($options['main_location'] == 'inside_visible') { echo 'dslc-cpt-post-main-visible'; } ?> dslc-on-hover-anim-target dslc-anim-<?php echo $options['css_anim_hover']; ?> " data-dslc-anim="<?php echo $options['css_anim_hover']; ?> "> <div class="dslc-cpt-post-main-inner dslc-init-<?php echo $options['main_position']; ?> "> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-cpt-post-title"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-cpt-post-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('meta', $post_elements)) { ?> <div class="dslc-cpt-post-meta"> <div class="dslc-cpt-post-meta-author"> <?php _e('By', 'dslc_string'); ?> <?php the_author_posts_link(); ?> </div><!-- .dslc-cpt-post-meta-author --> <div class="dslc-cpt-post-meta-date"> <?php the_time(get_option('date_format')); ?> </div><!-- .dslc-cpt-post-meta-date --> </div><!-- .dslc-cpt-post-meta --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-cpt-post-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); ?> <?php } ?> </div><!-- .dslc-cpt-post-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-cpt-post-read-more"> <a href="<?php the_permalink(); ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-cpt-post-read-more --> <?php } ?> </div><!-- .dslc-cpt-post-main-inner --> </div><!-- .dslc-cpt-post-main --> <?php } ?> </div><!-- .dslc-cpt-post-thumb --> <?php } ?> <?php if ($options['main_location'] == 'bellow' && ($post_elements == 'all' || in_array('title', $post_elements) || in_array('meta', $post_elements) || in_array('excerpt', $post_elements) || in_array('button', $post_elements))) { ?> <div class="dslc-post-main dslc-cpt-post-main"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-cpt-post-title"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> </div><!-- .dslc-cpt-post-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('meta', $post_elements)) { ?> <div class="dslc-cpt-post-meta"> <div class="dslc-cpt-post-meta-author"> <?php _e('By', 'dslc_string'); ?> <?php the_author_posts_link(); ?> </div><!-- .dslc-cpt-post-meta-author --> <div class="dslc-cpt-post-meta-date"> <?php the_time(get_option('date_format')); ?> </div><!-- .dslc-cpt-post-meta-date --> </div><!-- .dslc-cpt-post-meta --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-cpt-post-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php // Lumberman edit start if (post_type_supports(get_post_type(), 'excerpt')) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { // show 'dslc_search_content' metabox as excerpt for the content types // that have no 'excerpt' feature enabled echo do_shortcode(wp_trim_words(get_post_meta(get_the_ID(), 'dslc_search_content', true), $options['excerpt_length'])); } // Lumberman edit end ?> <?php } ?> </div><!-- .dslc-cpt-post-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('button', $post_elements)) { ?> <div class="dslc-cpt-post-read-more"> <a href="<?php the_permalink(); ?> "> <?php if (isset($options['button_icon_id']) && $options['button_icon_id'] != '') { ?> <span class="dslc-icon dslc-icon-<?php echo $options['button_icon_id']; ?> "></span> <?php } ?> <?php echo $options['button_text']; ?> </a> </div><!-- .dslc-cpt-post-read-more --> <?php } ?> </div><!-- .dslc-cpt-post-main --> <?php } ?> </div><!-- .dslc-cpt-post --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><!--.dslc-posts-inner --><?php ?> </div><!-- .dslc-cpt-posts --><?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red">You do not have any posts of that post type at the moment. <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ // if ( isset( $options['pagination_type'] ) && $options['pagination_type'] == 'numbered' ) { // Always show pagination for archive listings $num_pages = $dslc_query->max_num_pages; dslc_post_pagination(array('pages' => $num_pages)); // } wp_reset_query(); $this->module_end($options); }
function output($options) { global $dslc_active; if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) { $dslc_is_admin = true; } else { $dslc_is_admin = false; } $this->module_start($options); /* Module output stars here */ if (!isset($options['excerpt_length'])) { $options['excerpt_length'] = 20; } if (is_front_page()) { $paged = get_query_var('page') ? get_query_var('page') : 1; } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } // Fix for pagination from other modules affecting this one when pag disabled if ($options['pagination_type'] == 'disabled') { $paged = 1; } // Fix for offset braking pagination $query_offset = $options['offset']; if ($query_offset > 0 && $paged > 1) { $query_offset = ($paged - 1) * $options['amount'] + $options['offset']; } $args = array('paged' => $paged, 'post_type' => 'dslc_staff', 'posts_per_page' => $options['amount'], 'order' => $options['order'], 'orderby' => $options['orderby'], 'offset' => $query_offset); if (isset($options['categories']) && $options['categories'] != '') { $cats_array = explode(' ', trim($options['categories'])); $args['tax_query'] = array(array('taxonomy' => 'dslc_staff_cats', 'field' => 'slug', 'terms' => $cats_array, 'operator' => $options['categories_operator'])); } // Exlcude and Include arrays $exclude = array(); $include = array(); // Exclude current post if (is_singular(get_post_type())) { $exclude[] = get_the_ID(); } // Exclude posts ( option ) if ($options['query_post_not_in']) { $exclude = array_merge($exclude, explode(' ', $options['query_post_not_in'])); } // Include posts ( option ) if ($options['query_post_in']) { $include = array_merge($include, explode(' ', $options['query_post_in'])); } // Include query parameter if (!empty($include)) { $args['post__in'] = $include; } // Exclude query parameter if (!empty($exclude)) { $args['post__not_in'] = $exclude; } // No paging if ($options['pagination_type'] == 'disabled') { $args['no_found_rows'] = true; } // Do the query if (is_category() || is_tax() || is_search()) { global $wp_query; $dslc_query = $wp_query; } else { $dslc_query = new WP_Query($args); } $columns_class = 'dslc-col dslc-' . $options['columns'] . '-col '; $count = 0; $real_count = 0; $increment = $options['columns']; $max_count = 12; /** * Elements to show */ // Post Elements $post_elements = $options['post_elements']; if (!empty($post_elements)) { $post_elements = explode(' ', trim($post_elements)); } else { $post_elements = 'all'; } // Carousel Elements $carousel_elements = $options['carousel_elements']; if (!empty($carousel_elements)) { $carousel_elements = explode(' ', trim($carousel_elements)); } else { $carousel_elements = array(); } /* Container Class */ $container_class = 'dslc-posts dslc-staff dslc-clearfix '; if ($options['type'] == 'masonry') { $container_class .= 'dslc-init-masonry '; } elseif ($options['type'] == 'carousel') { $container_class .= 'dslc-init-carousel '; } elseif ($options['type'] == 'grid') { $container_class .= 'dslc-init-grid '; } /* Element Class */ $element_class = 'dslc-post dslc-staff-member '; if ($options['type'] == 'masonry') { $element_class .= 'dslc-masonry-item '; } elseif ($options['type'] == 'carousel') { $element_class .= 'dslc-carousel-item '; } /** * Carousel Items */ switch ($options['columns']) { case 12: $carousel_items = 1; break; case 6: $carousel_items = 2; break; case 4: $carousel_items = 3; break; case 3: $carousel_items = 4; break; case 2: $carousel_items = 6; break; default: $carousel_items = 6; break; } /** * Posts ( output ) */ if ($dslc_query->have_posts()) { ?> <div class="<?php echo $container_class; ?> "><?php if ($options['type'] == 'carousel') { ?> <div class="dslc-loader"></div><div class="dslc-carousel" data-stop-on-hover="<?php echo $options['carousel_autoplay_hover']; ?> " data-autoplay="<?php echo $options['carousel_autoplay']; ?> " data-columns="<?php echo $carousel_items; ?> " data-pagination="<?php if (in_array('circles', $carousel_elements)) { echo 'true'; } else { echo 'false'; } ?> " data-slide-speed="<?php echo $options['arrows_slide_speed']; ?> " data-pagination-speed="<?php echo $options['circles_slide_speed']; ?> "><?php } while ($dslc_query->have_posts()) { $dslc_query->the_post(); $count += $increment; $real_count++; if ($count == $max_count) { $count = 0; $extra_class = ' dslc-last-col'; } elseif ($count == $increment) { $extra_class = ' dslc-first-col'; } else { $extra_class = ''; } if (!has_post_thumbnail()) { $extra_class .= ' dslc-post-no-thumb'; } $post_cats = get_the_terms(get_the_ID(), 'dslc_staff_cats'); $post_cats_data = ''; if (!empty($post_cats)) { foreach ($post_cats as $post_cat) { $post_cats_data .= $post_cat->slug . ' '; } } ?> <?php $social = $socials = array(); $position = get_post_meta(get_the_ID(), 'dslc_staff_position', true); $social['twitter'] = get_post_meta(get_the_ID(), 'dslc_staff_social_twitter', true); $social['facebook'] = get_post_meta(get_the_ID(), 'dslc_staff_social_facebook', true); $social['google-plus'] = get_post_meta(get_the_ID(), 'dslc_staff_social_googleplus', true); $social['linkedin'] = get_post_meta(get_the_ID(), 'dslc_staff_social_linkedin', true); $social['dribbble'] = get_post_meta(get_the_ID(), 'dslc_staff_social_dribbble', true); $social['github'] = get_post_meta(get_the_ID(), 'dslc_staff_social_github', true); $social['stackexchange'] = get_post_meta(get_the_ID(), 'dslc_staff_social_stackexchange', true); $social['vk'] = get_post_meta(get_the_ID(), 'dslc_staff_social_vk', true); $social['weibo'] = get_post_meta(get_the_ID(), 'dslc_staff_social_weibo', true); $social['xing'] = get_post_meta(get_the_ID(), 'dslc_staff_social_xing', true); $social['renren'] = get_post_meta(get_the_ID(), 'dslc_staff_social_renren', true); $social['foursquare'] = get_post_meta(get_the_ID(), 'dslc_staff_social_foursquare', true); $social['instagram'] = get_post_meta(get_the_ID(), 'dslc_staff_social_instagram', true); $social['pinterest'] = get_post_meta(get_the_ID(), 'dslc_staff_social_pinterest', true); $social['skype'] = get_post_meta(get_the_ID(), 'dslc_staff_social_skype', true); $social['tumblr'] = get_post_meta(get_the_ID(), 'dslc_staff_social_tumblr', true); $social['pagelines'] = get_post_meta(get_the_ID(), 'dslc_staff_social_pagelines', true); $social['youtube'] = get_post_meta(get_the_ID(), 'dslc_staff_social_youtube', true); $social['flickr'] = get_post_meta(get_the_ID(), 'dslc_staff_social_flickr', true); $social['vimeo-square'] = get_post_meta(get_the_ID(), 'dslc_staff_social_vimeo', true); $social['envelope'] = get_post_meta(get_the_ID(), 'dslc_staff_social_envelope', true); foreach ($social as $k => $v) { if (!empty($v)) { $socials[$k] = $v; } } ?> <div class="<?php echo $element_class . $columns_class . $extra_class; ?> " data-cats="<?php echo $post_cats_data; ?> "> <?php if ($post_elements == 'all' || in_array('thumbnail', $post_elements)) { ?> <?php /** * Manual Resize */ $manual_resize = false; if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height']) || isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $manual_resize = true; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $thumb_url = $thumb_url[0]; $thumb_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); if (!$thumb_alt) { $thumb_alt = ''; } $resize_width = false; $resize_height = false; if (isset($options['thumb_resize_width_manual']) && !empty($options['thumb_resize_width_manual'])) { $resize_width = $options['thumb_resize_width_manual']; } if (isset($options['thumb_resize_height']) && !empty($options['thumb_resize_height'])) { $resize_height = $options['thumb_resize_height']; } } ?> <?php if (has_post_thumbnail()) { ?> <?php $black_white = ''; if ($options['effect_hover_img'] == 'black_white') { $black_white = ' as-grayscale'; } ?> <div class="dslc-post-thumb dslc-staff-member-thumb dslc-on-hover-anim <?php echo $black_white; ?> "> <div class="dslc-staff-member-thumb-inner dslca-post-thumb"> <?php if ($manual_resize) { ?> <img src="<?php $res_img = dslc_aq_resize($thumb_url, $resize_width, $resize_height, true); echo $res_img; ?> " alt="<?php echo $thumb_alt; ?> " /> <?php } else { ?> <?php the_post_thumbnail('full'); ?> <?php } ?> </div> </div><!-- .dslc-staff-member-thumb --> <?php } ?> <?php } ?> <?php if ($post_elements == 'all' || in_array('title', $post_elements) || in_array('position', $post_elements) || in_array('excerpt', $post_elements)) { ?> <div class="dslc-staff-member-main"> <?php if ($post_elements == 'all' || in_array('title', $post_elements)) { ?> <div class="dslc-staff-member-title"> <h2><?php the_title(); ?> </h2> </div><!-- .dslc-staff-member-title --> <?php } ?> <?php if ($post_elements == 'all' || in_array('position', $post_elements)) { ?> <div class="dslc-staff-member-position"> <?php echo $position; ?> </div><!-- .dslc-staff-member-position --> <?php } ?> <?php if ($post_elements == 'all' || in_array('excerpt', $post_elements)) { ?> <div class="dslc-staff-member-excerpt"> <?php if ($options['excerpt_or_content'] == 'content') { ?> <?php the_content(); ?> <?php } else { ?> <?php if (has_excerpt()) { echo do_shortcode(wp_trim_words(get_the_excerpt(), $options['excerpt_length'])); } else { echo do_shortcode(wp_trim_words(get_the_content(), $options['excerpt_length'])); } ?> <?php } ?> </div><!-- .dslc-staff-member-excerpt --> <?php } ?> <?php if ($post_elements == 'all' || in_array('social', $post_elements)) { ?> <div class="as-staff-social-wrapper"> <div class="as-staff-list-social"> <?php foreach ($socials as $k => $v) { if (!empty($v)) { ?> <a href="<?php echo $v; ?> " target="<?php echo $options['social_link_target']; ?> "><span class="dslc-icon dslc-icon-<?php echo $k; ?> "></span></a> <?php } } ?> </div> </div> <?php } ?> <!-- .dslc-staff-social --> </div><!-- .dslc-staff-member-main --> <?php } ?> </div><!-- .dslc-staff-member --> <?php // Row Separator if ($options['type'] == 'grid' && $count == 0 && $real_count != $dslc_query->found_posts && $real_count != $options['amount'] && $options['separator_enabled'] == 'enabled') { echo '<div class="dslc-post-separator"></div>'; } } if ($options['type'] == 'carousel') { ?> </div><?php } ?> </div><?php } else { if ($dslc_is_admin) { ?> <div class="dslc-notification dslc-red"><?php _e('You do not have staff at the moment. Go to <strong>WP Admin → Staff</strong> to add some.', 'dslc_string'); ?> <span class="dslca-refresh-module-hook dslc-icon dslc-icon-refresh"></span></span></div><?php } } /** * Pagination */ if (isset($options['pagination_type']) && $options['pagination_type'] != 'disabled') { $num_pages = $dslc_query->max_num_pages; if ($options['offset'] > 0) { $num_pages = ceil(($dslc_query->found_posts - $options['offset']) / $options['amount']); } dslc_post_pagination(array('pages' => $num_pages, 'type' => $options['pagination_type'])); } wp_reset_postdata(); /* Module output ends here */ $this->module_end($options); }