function presscore_blog_ajax_loading_responce($ajax_data = array()) { global $post, $wp_query, $paged, $page; extract($ajax_data); if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) { $responce = array('success' => false, 'reason' => 'corrupted data'); } else { require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php'; require_once PRESSCORE_DIR . '/template-hooks.php'; require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php'; // get page query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page)); $html = ''; if (have_posts() && !post_password_required()) { while (have_posts()) { the_post(); // main loop $config = Presscore_Config::get_instance(); $config->set('template', 'blog'); $config->set('layout', empty($page_data['layout']) ? 'masonry' : $page_data['layout']); presscore_config_base_init(); presscore_react_on_categorizer(); do_action('presscore_before_loop'); ob_start(); $query = presscore_get_blog_query(); if ($query->have_posts()) { $page_layout = presscore_get_current_layout_type(); $current_post = $posts_count; while ($query->have_posts()) { $query->the_post(); /* // check if current post already loaded $key_in_loaded = array_search( $post->ID, $loaded_items ); if ( false !== $key_in_loaded ) { unset( $loaded_items[ $key_in_loaded ] ); continue; } */ presscore_populate_post_config(); switch ($page_layout) { case 'masonry': presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post'); break; case 'list': // global posts counter $config->set('post.query.var.current_post', ++$current_post); presscore_get_template_part('theme', 'blog/list/blog-list-post'); break; } } wp_reset_postdata(); } $html .= ob_get_clean(); } $responce = array('success' => true); /////////////////// // pagination // /////////////////// $next_page_link = dt_get_next_posts_url($query->max_num_pages); if ($next_page_link) { $responce['nextPage'] = dt_get_paged_var() + 1; } else { $responce['nextPage'] = 0; } $load_style = $config->get('load_style'); // pagination style if (presscore_is_load_more_pagination()) { $pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax'); if ($pagination) { $responce['currentPage'] = dt_get_paged_var(); $responce['paginationHtml'] = $pagination; } else { $responce['currentPage'] = $post_paged; } $responce['paginationType'] = 'more'; } else { if ('ajax_pagination' == $load_style) { ob_start(); dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true)); $pagination = ob_get_clean(); if ($pagination) { $responce['paginationHtml'] = $pagination; } $responce['paginationType'] = 'paginator'; } } ///////////////// // response // ///////////////// $responce['itemsToDelete'] = array_values($loaded_items); // $responce['query'] = $page_query->query; $responce['order'] = $query->query['order']; $responce['orderby'] = $query->query['orderby']; } // main loop $responce['html'] = $html; } return $responce; }
function presscore_populate_team_config($target_post_id = 0) { global $post; if ($target_post_id) { $post_id = $target_post_id; } elseif ($post && !empty($post->ID)) { $post_id = $post->ID; } else { return false; } $config = Presscore_Config::get_instance(); $prefix = '_dt_teammate_options_'; // open as $open_as = get_post_meta($post_id, "{$prefix}go_to_single", true); $config->set('post.open_as', $open_as ? 'post' : 'none'); // position $config->set('post.member.position', get_post_meta($post_id, "{$prefix}position", true), ''); // links $teammate_links = presscore_get_team_links_array(); $links = array(); foreach ($teammate_links as $id => $data) { $link = get_post_meta($post_id, "{$prefix}{$id}", true); if ($link) { $links[$id] = $link; } } $config->set('post.preview.links', $links, array()); return true; }
public function shortcode($atts, $content = null) { $attributes = $this->sanitize_attributes($atts); if (presscore_vc_is_inline()) { $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy)); $dummy = ' <div class="dt_vc-shortcode_dummy dt_vc-photos_scroller" style="height: ' . $slider_args['height'] . 'px;"> <h5>Photos scroller</h5> <p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p> </div> '; return $dummy; } $attachments_ids = array(); // get albums $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1))); if ($dt_query->have_posts()) { // take albums id foreach ($dt_query->posts as $dt_post) { $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true); if ($album_attachments) { $attachments_ids = array_merge($attachments_ids, $album_attachments); } } } if ('rand' == $attributes['orderby']) { shuffle($attachments_ids); } // new query to take attachments $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']); $config = Presscore_Config::get_instance(); $slider_class = array('shortcode-instagram'); if ('disabled' == $config->get('sidebar_position')) { $slider_class[] = 'full'; } $slider_style = array(); if ($attributes['margin_bottom']) { $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom']; } if ($attributes['margin_top']) { $slider_style[] = 'margin-top: ' . $attributes['margin_top']; } $slider_fields = array(); /*if ( $attributes['arrows'] ) { $slider_fields[] = 'arrows'; }*/ $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo'); $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons); /*if ( $attributes['slider_title'] ) { $slider_args['title'] = $attributes['slider_title']; }*/ if ($attributes['height']) { $slider_args['height'] = $attributes['height']; } if ($attributes['width']) { $slider_args['img_width'] = $attributes['width']; } $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args); return $output; }
function presscore_footer_html_class($class = array()) { $output = array('footer'); $config = Presscore_Config::get_instance(); switch ($config->get('template.footer.style')) { case 'full_width_line': $output[] = 'full-width-line'; break; case 'solid_background': $output[] = 'solid-bg'; break; case 'transparent_bg_line': $output[] = 'transparent-bg'; break; // default - content_width_line } ////////////// // Output // ////////////// if ($class && !is_array($class)) { $class = explode(' ', $class); } $output = apply_filters('presscore_footer_html_class', array_merge($class, $output)); return $output ? sprintf('class="%s"', presscore_esc_implode(' ', array_unique($output))) : ''; }
/** * Render 3D slider. * */ function presscore_render_3d_slider_data() { global $post; $config = Presscore_Config::get_instance(); $slider_id = $config->get('slideshow_sliders'); $slideshows = presscore_query()->get_posts(array('post_type' => 'dt_slideshow', 'post__in' => $slider_id, 'has_password' => false)); if (!$slideshows || !$slideshows->have_posts()) { return; } $slides = array(); foreach ($slideshows->posts as $slideshow) { $media_items = get_post_meta($slideshow->ID, '_dt_slider_media_items', true); if (empty($media_items)) { continue; } $slides = array_merge($slides, $media_items); } $attachments_data = presscore_get_attachment_post_data($slides); $count = count($attachments_data); if ($count < 10) { $chunks = array($attachments_data, array(), array()); } else { $length = ceil($count / 3); $chunks = array_chunk($attachments_data, $length); } $chunks = array_reverse($chunks); foreach ($chunks as $layer => $images) { printf('<div id="level%d" class="plane">' . "\n", $layer + 1); foreach ($images as $img) { printf('<img src="%s" alt="%s" />' . "\n", esc_url($img['full']), esc_attr($img['description'])); } echo "</div>\n"; } }
/** * Portfolio slider. * */ public function portfolio_slider($attributes = array()) { $config = Presscore_Config::get_instance(); $slider_fields = array(); if ($attributes['show_title']) { $slider_fields[] = 'title'; } if ($attributes['meta_info']) { $slider_fields[] = 'meta'; } if ($attributes['show_excerpt']) { $slider_fields[] = 'description'; } if ($attributes['show_link']) { $slider_fields[] = 'link'; } if ($attributes['show_zoom']) { $slider_fields[] = 'zoom'; } if ($attributes['show_details']) { $slider_fields[] = 'details'; } $slider_style = array(); if ($attributes['margin_bottom']) { $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom']; } if ($attributes['margin_top']) { $slider_style[] = 'margin-top: ' . $attributes['margin_top']; } $slider_args = array('mode' => $attributes['appearance'], 'fields' => $slider_fields, 'style' => implode(';', $slider_style), 'under_image_buttons' => $attributes['under_image_buttons'], 'hover_animation' => $attributes['hover_animation'], 'hover_bg_color' => $attributes['hover_bg_color'], 'hover_content_visibility' => $attributes['hover_content_visibility']); if ($attributes['height']) { $slider_args['height'] = $attributes['height']; } if ($attributes['width']) { $slider_args['img_width'] = $attributes['width']; } if (function_exists('vc_is_inline') && vc_is_inline()) { $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_portfolio_category')); $output = ' <div class="dt_vc-shortcode_dummy dt_vc-portfolio_scroller" style="height: ' . $slider_args['height'] . 'px;"> <h5>Portfolio scroller</h5> <p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p> </div> '; } else { $related_posts_args = array('exclude_current' => false, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'field' => 'slug', 'args' => array('posts_per_page' => $attributes['number'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'])); $related_posts_args['cats'] = $attributes['category']; if (!empty($attributes['category'])) { $related_posts_args['select'] = 'only'; } else { $related_posts_args['select'] = 'all'; } $attachments_data = presscore_get_related_posts($related_posts_args); $output = presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $slider_args); } return $output; }
public function do_header_slideshow($type) { global $post; $config = Presscore_Config::get_instance(); switch ($type) { case 'porthole': $class = 'fixed' == $config->get('slideshow_layout') ? 'class="fixed" ' : ''; $height = absint($config->get('slideshow_slider_height')); $width = absint($config->get('slideshow_slider_width')); if (!$height) { $height = 500; } if (!$width) { $width = 1200; } printf('<div id="main-slideshow" %sdata-width="%d" data-height="%d" data-autoslide="%d" data-scale="%s" data-paused="%s"></div>', $class, $width, $height, absint($config->get('slideshow_autoslide_interval')), 'fit' == $config->get('slideshow_slider_scaling') ? 'fit' : 'fill', 'paused' == $config->get('slideshow_autoplay') ? 'true' : 'false'); add_action('wp_footer', 'presscore_render_porthole_slider_data', 15); break; case 'photo_scroller': $slides = array(); $slider_id = $config->get('slideshow_sliders'); $slideshow = presscore_query()->get_posts(array('post_type' => 'dt_slideshow', 'post__in' => $slider_id, 'has_password' => false)); // prepare data if ($slideshow->have_posts()) { while ($slideshow->have_posts()) { $slideshow->the_post(); $media_items = get_post_meta($post->ID, '_dt_slider_media_items', true); if (empty($media_items)) { continue; } $slides = array_merge($slides, $media_items); } wp_reset_postdata(); } $photo_scroller = new Presscore_PhotoScroller($slides, array('wrap_class' => 'fullscreen' == $config->get('slideshow.photo_scroller.layout') ? 'fullscreen-scroller' : '', 'background_color' => $config->get('slideshow.photo_scroller.background.color'), 'padding_top' => $config->get('slideshow.photo_scroller.padding.top'), 'padding_bottom' => $config->get('slideshow.photo_scroller.padding.bottom'), 'padding_side' => $config->get('slideshow.photo_scroller.padding.side'), 'autoplay' => 'play' == $config->get('slideshow.photo_scroller.autoplay.mode'), 'autoplay_speed' => $config->get('slideshow.photo_scroller.autoplay.speed'), 'thumbnails_visibility' => $config->get('slideshow.photo_scroller.thumbnails.visibility'), 'thumbnails_width' => $config->get('slideshow.photo_scroller.thumbnail.width'), 'thumbnails_height' => $config->get('slideshow.photo_scroller.thumbnail.height'), 'portrait_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.mobile')), 'landscape_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.mobile')), 'inactive_opacity' => $config->get('slideshow.photo_scroller.inactive.opacity'), 'show_overlay' => $config->get('slideshow.photo_scroller.overlay.enabled'), 'show_post_navigation' => false, 'show_share_buttons' => false)); if ($photo_scroller->have_slides()) { echo $photo_scroller->get_html(); } break; case '3d': $class = ''; $data_attr = ''; $slider_layout = $config->get('slideshow_3d_layout'); if (in_array($slider_layout, array('prop-fullwidth', 'prop-content-width'))) { $class = 'prop-fullwidth' == $slider_layout ? 'class="fixed-height" ' : 'class="fixed" '; $width = $config->get('slideshow_3d_slider_width'); $height = $config->get('slideshow_3d_slider_height'); $data_attr = sprintf(' data-width="%d" data-height="%d"', $width ? absint($width) : 2500, $height ? absint($height) : 1200); } printf('<div id="main-slideshow" %s><div class="three-d-slider"%s><span id="loading">0</span></div></div>', $class, $data_attr); add_action('wp_footer', 'presscore_render_3d_slider_data', 15); break; } // switch }
/** * Portfolio slider. * */ public function portfolio_slider($attributes = array()) { $config = Presscore_Config::get_instance(); $related_posts_args = array('exclude_current' => false, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'field' => 'slug', 'args' => array('posts_per_page' => $attributes['number'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'])); if (!empty($attributes['category'])) { $related_posts_args['cats'] = $attributes['category']; $related_posts_args['select'] = 'only'; } else { $related_posts_args['select'] = 'all'; } $attachments_data = presscore_get_related_posts($related_posts_args); $slider_class = array(); if ('disabled' == $config->get('sidebar_position')) { $slider_class[] = 'full'; } $slider_fields = array(); if ($attributes['show_title']) { $slider_fields[] = 'title'; } if ($attributes['meta_info']) { $slider_fields[] = 'meta'; } if ($attributes['show_excerpt']) { $slider_fields[] = 'description'; } if ($attributes['show_link']) { $slider_fields[] = 'link'; } if ($attributes['show_zoom']) { $slider_fields[] = 'zoom'; } if ($attributes['show_details']) { $slider_fields[] = 'details'; } $slider_style = array(); if ($attributes['margin_bottom']) { $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom']; } if ($attributes['margin_top']) { $slider_style[] = 'margin-top: ' . $attributes['margin_top']; } $slider_args = array('mode' => $attributes['appearance'], 'fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'under_image_buttons' => $attributes['under_image_buttons'], 'hover_animation' => $attributes['hover_animation'], 'hover_bg_color' => $attributes['hover_bg_color'], 'hover_content_visibility' => $attributes['hover_content_visibility']); if ($attributes['height']) { $slider_args['height'] = $attributes['height']; } if ($attributes['width']) { $slider_args['img_width'] = $attributes['width']; } $output = presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $slider_args); return $output; }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, self::$widget_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_team', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_team_category', 'field' => 'term_id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } $p_query = new WP_Query($args); $autoslide = absint($instance['autoslide']); echo $before_widget . "\n"; // title if ($title) { echo $before_title . $title . $after_title . "\n"; } if ($p_query->have_posts()) { update_post_thumbnail_cache($p_query); echo '<ul class="team-items slider-content round-images bg-under-post rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n"; // get config instance $config = Presscore_Config::get_instance(); // backup and reset config $config_backup = $config->get(); $this->setup_config($instance); while ($p_query->have_posts()) { $p_query->the_post(); presscore_populate_team_config(); echo '<li>'; $this->render_teammate($instance); echo '</li>'; } // while have posts wp_reset_postdata(); // restore config $config->reset($config_backup); echo '</ul>', "\n"; } // if have posts echo $after_widget . "\n"; }
function presscore_post_navigation() { if (!in_the_loop()) { return ''; } $config = Presscore_Config::get_instance(); $output = ''; if ($config->get('post.navigation.arrows.enabled')) { $output .= presscore_get_next_post_link('', 'prev-post', '<a class="prev-post disabled" href="javascript: void(0);"></a>'); } if ($config->get('post.navigation.back_button.enabled')) { $output .= presscore_get_post_back_link(); } if ($config->get('post.navigation.arrows.enabled')) { $output .= presscore_get_previous_post_link('', 'next-post', '<a class="next-post disabled" href="javascript: void(0);"></a>'); } return $output; }
/** * [presscore_masonry_container_data_atts description] * * @since 1.0.0 * * @return satring [description] */ function presscore_masonry_container_data_atts($custom_atts = array()) { $config = Presscore_Config::get_instance(); $data_atts = array('data-padding="' . intval($config->get('item_padding')) . 'px"', 'data-cur-page="' . dt_get_paged_var() . '"'); $data_atts = array_merge($data_atts, $custom_atts); if ($config->get('hide_last_row')) { $data_atts[] = 'data-part-row="false"'; } $target_height = $config->get('target_height'); if (null !== $target_height) { $data_atts[] = 'data-target-height="' . absint($target_height) . 'px"'; } $target_width = $config->get('post.preview.width.min'); if (null !== $target_width) { $data_atts[] = 'data-width="' . absint($target_width) . 'px"'; } $columns = $config->get('template.columns.number'); if (null !== $columns) { $data_atts[] = 'data-columns="' . absint($columns) . '"'; } return ' ' . implode(' ', $data_atts); }
/** * Main container classes. * */ function dt_woocommerce_main_container_class_filter($classes = array()) { $config = Presscore_Config::get_instance(); switch ($config->get('sidebar_position')) { case 'left': $classes[] = 'sidebar-left'; break; case 'disabled': $classes[] = 'sidebar-none'; break; default: $classes[] = 'sidebar-right'; } return $classes; }
function presscore_body_class($classes) { $config = Presscore_Config::get_instance(); $desc_on_hoover = 'under_image' != $config->get('post.preview.description.style'); $template = $config->get('template'); $layout = $config->get('layout'); /////////////////////// // template classes // /////////////////////// switch ($template) { case 'blog': $classes[] = 'blog'; break; case 'portfolio': $classes[] = 'portfolio'; break; case 'team': $classes[] = 'team'; break; case 'testimonials': $classes[] = 'testimonials'; break; case 'archive': $classes[] = 'archive'; break; case 'search': $classes[] = 'search'; break; case 'albums': $classes[] = 'albums'; break; case 'media': $classes[] = 'media'; break; case 'microsite': $classes[] = 'one-page-row'; break; } ///////////////////// // layout classes // ///////////////////// switch ($layout) { case 'masonry': if ($desc_on_hoover) { $classes[] = 'layout-masonry-grid'; } else { $classes[] = 'layout-masonry'; } break; case 'grid': $classes[] = 'layout-grid'; if ($desc_on_hoover) { $classes[] = 'grid-text-hovers'; } break; case 'checkerboard': case 'list': case 'right_list': $classes[] = 'layout-list'; break; } //////////////////// // hover classes // //////////////////// if (in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team'))) { $classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image'; } ////////////////////////////////////// // hide dividers if content is off // ////////////////////////////////////// if (in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout')) { $show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links'); if (!$show_dividers) { $classes[] = 'description-off'; } } ///////////////////// // single classes // ///////////////////// if (is_single() && (post_password_required() || !comments_open() && '0' == get_comments_number())) { $classes[] = 'no-comments'; } //////////////////////// // header background // //////////////////////// if (presscore_mixed_header_with_top_line()) { $classes[] = 'header-top-line-active'; } if (presscore_header_with_bg() && (presscore_mixed_header_with_top_line() || !presscore_header_layout_is_side())) { switch ($config->get('header_background')) { case 'overlap': $classes['header_background'] = 'overlap'; break; case 'transparent': $classes['header_background'] = 'transparent'; if ('light' === $config->get('header.transparent.color_scheme')) { $classes[] = 'light-preset-color'; } break; } if ($config->get_bool('header.slideshow.header_below') && 'slideshow' === $config->get('header_title') && in_array($config->get('header_background'), array('transparent', 'normal'))) { $classes[] = 'floating-navigation-below-slider'; } } /////////////////// // header title // /////////////////// if ('fancy' == $config->get('header_title')) { $classes[] = 'fancy-header-on'; } elseif ('slideshow' == $config->get('header_title')) { $classes[] = 'slideshow-on'; if ('3d' == $config->get('slideshow_mode') && 'fullscreen-content' == $config->get('slideshow_3d_layout')) { $classes[] = 'threed-fullscreen'; } if (dt_get_paged_var() > 1 && isset($classes['header_background'])) { unset($classes['header_background']); } } elseif (is_single() && 'disabled' == $config->get('header_title')) { $classes[] = 'title-off'; } /////////////////// // hover style // /////////////////// switch ($config->get('template.images.hover.style')) { case 'grayscale': $classes[] = 'filter-grayscale-static'; break; case 'gray_color': $classes[] = 'filter-grayscale'; break; case 'blur': $classes[] = 'image-blur'; break; case 'scale': $classes[] = 'scale-on-hover'; break; } // default hover icons switch ($config->get('template.images.hover.icon')) { case 'none': $classes[] = 'disabled-hover-icons'; break; case 'small_corner': $classes[] = 'small-hover-icons'; break; case 'big_center': $classes[] = 'large-hover-icons'; break; } if ($config->get('template.images.hover.animation')) { $classes[] = 'click-effect-on-img'; } //////////// // boxed // //////////// if ('boxed' == $config->get('template.layout')) { $classes[] = 'boxed-layout'; } ///////////////////// // responsiveness // ///////////////////// if (!presscore_responsive()) { $classes[] = 'responsive-off'; } ///////////////////// // justified grid // ///////////////////// if ($config->get('justified_grid')) { $classes[] = 'justified-grid'; } //////////////////// // header layout // //////////////////// switch ($config->get('header.position')) { case 'right': $classes[] = 'header-side-right'; break; case 'left': $classes[] = 'header-side-left'; break; } switch ($config->get('header.layout')) { case 'slide_out': $classes[] = 'sticky-header'; break; case 'overlay': $classes[] = 'overlay-navigation'; break; } switch ($config->get('header.layout.slide_out.animation')) { case 'fade': $classes[] = 'fade-header-animation'; break; case 'move': $classes[] = 'move-header-animation'; break; case 'slide': $classes[] = 'slide-header-animation'; break; } if ('side_line' === $config->get('header.mixed.view')) { $classes[] = 'header-side-line'; switch ($config->get('header.mixed.view.side_line.position')) { case 'above': $classes[] = 'header-above-side-line'; break; case 'under': $classes[] = 'header-under-side-line'; break; } } if ($config->get('header.layout.slide_out.x_cursor.enabled')) { $classes[] = 'overlay-cursor-on'; } ////////////////////// // accent gradient // ////////////////////// if ('gradient' == $config->get('template.accent.color.mode')) { $classes[] = 'accent-gradient'; } ////////////////////////////// // srcset based hd images // ////////////////////////////// if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) { $classes[] = 'srcset-enabled'; } /////////////// // buttons // /////////////// // buttons style switch ($config->get('buttons.style')) { case '3d': $classes[] = 'btn-3d'; break; case 'flat': $classes[] = 'btn-flat'; break; case 'material': $classes[] = 'btn-material'; break; case 'ios7': default: $classes[] = 'btn-ios'; break; } // buttons text color switch ($config->get('buttons.text.color')) { case 'accent': $classes[] = 'accent-btn-color'; break; case 'color': $classes[] = 'custom-btn-color'; break; } // buttons hover text color switch ($config->get('buttons.hover.text.color')) { case 'accent': $classes[] = 'accent-btn-hover-color'; break; case 'color': $classes[] = 'custom-btn-hover-color'; break; } if ($config->get('template.footer.background.slideout_mode')) { $classes[] = 'footer-overlap'; } //////////////////////// // content boxes bg // //////////////////////// switch ($config->get('template.content.boxes.background.decoration')) { case 'shadow': $classes[] = 'shadow-element-decoration'; break; case 'outline': $classes[] = 'outline-element-decoration'; break; } //////////////////// // filter style // //////////////////// switch ($config->get('template.posts_filter.style')) { case 'ios': $classes[] = 'filter-style-ios'; break; case 'minimal': $classes[] = 'filter-style-minimal'; break; case 'material': $classes[] = 'filter-style-material'; break; } ////////////////////////// // contact form style // ////////////////////////// switch ($config->get('template.contact_form.style')) { case 'ios': $classes[] = 'contact-form-ios'; break; case 'minimal': $classes[] = 'contact-form-minimal'; break; case 'material': $classes[] = 'contact-form-material'; break; } /////////////////////// // fancy date size // /////////////////////// if ('small' == $config->get('post.fancy_date.size')) { $classes[] = 'small-fancy-datas'; } else { $classes[] = 'large-fancy-datas'; } if ($config->get_bool('header.layout.slide_out.blur.enabled')) { $classes[] = 'blur-page'; } /////////////////////////////// // slideshow bullets style // /////////////////////////////// switch ($config->get('slideshow.bullets.style')) { case 'transparent': $classes[] = 'semitransparent-bullets'; break; case 'accent': $classes[] = 'accent-bullets'; break; case 'outline': $classes[] = 'outlines-bullets'; break; } /////////////////// // icons style // /////////////////// switch ($config->get('template.icons.style')) { case 'bold': $classes[] = 'bold-icons'; break; case 'light': $classes[] = 'light-icons'; break; } ///////////////////// // floating menu // ///////////////////// if ($config->get('header.floating_navigation.enabled')) { $classes[] = presscore_array_value($config->get('header.floating_navigation.style'), array('fade' => 'phantom-fade', 'slide' => 'phantom-slide', 'sticky' => 'phantom-sticky')); $classes[] = presscore_array_value($config->get('header.floating_navigation.decoraion'), array('disabled' => 'phantom-disable-decoration', 'shadow' => 'phantom-shadow-decoration', 'line' => 'phantom-line-decoration')); $classes[] = presscore_array_value($config->get('header.floating_navigation.logo.style'), array('custom' => 'phantom-custom-logo-on', 'main' => 'phantom-main-logo-on', 'none' => 'phantom-logo-off')); } $classes[] = presscore_array_value($config->get('header.mobile.floatin_navigation'), array('sticky' => 'sticky-mobile-header', 'menu_icon' => 'floating-mobile-menu-icon')); //////////////////////////////////// // Sidebar and footer on mobile // //////////////////////////////////// if ('disabled' != $config->get('sidebar_position') && $config->get('sidebar_hide_on_mobile')) { $classes[] = 'mobile-hide-sidebar'; } if ($config->get('footer_show') && $config->get('footer_hide_on_mobile')) { $classes[] = 'mobile-hide-footer'; } if (in_array($config->get('header.layout'), array('classic', 'inline', 'split'))) { $classes[] = 'top-header'; } // mobile logo $classes[] = presscore_array_value($config->get('header.mobile.logo.first_switch.layout'), array('left_right' => 'first-switch-logo-right first-switch-menu-left', 'left_center' => 'first-switch-logo-center first-switch-menu-left', 'right_left' => 'first-switch-logo-left first-switch-menu-right', 'right_center' => 'first-switch-logo-center first-switch-menu-right')); $classes[] = presscore_array_value($config->get('header.mobile.logo.second_switch.layout'), array('left_right' => 'second-switch-logo-right second-switch-menu-left', 'left_center' => 'second-switch-logo-center second-switch-menu-left', 'right_left' => 'second-switch-logo-left second-switch-menu-right', 'right_center' => 'second-switch-logo-center second-switch-menu-right')); if ('right' === $config->get('header.mobile.menu.align')) { $classes[] = 'right-mobile-menu'; } ///////////// // return // ///////////// return array_values(array_unique($classes)); }
protected function setup_config(&$attributes) { $config = Presscore_Config::get_instance(); $config->set('template', 'team'); //////////////////// // Image sizing // //////////////////// $config->set('image_layout', $attributes['images_sizing']); $config->set('thumb_proportions', $attributes['proportion']); $config->set('show_excerpts', $attributes['show_excerpts']); ////////////// // Layout // ////////////// $config->set('layout', $attributes['type']); $config->set('full_width', $attributes['full_width']); $config->set('post.preview.description.style', 'under_image'); $config->set('load_style', 'default'); /////////////////// // Items style // /////////////////// $config->set('item_padding', $attributes['padding']); $config->set('post.preview.width.min', $attributes['column_width']); $config->set('template.columns.number', $attributes['columns']); $config->set('post.preview.background.enabled', $attributes['members_bg']); }
/** * Description here * * @since 4.3.0 * @return bool */ function presscore_is_load_more_pagination() { $config = Presscore_Config::get_instance(); return in_array($config->get('load_style'), array('ajax_more', 'lazy_loading')); }
/** * [presscore_hover_animation_class description] * * @since 1.0.0 * * @return string [description] */ function presscore_hover_animation_class() { $config = Presscore_Config::get_instance(); switch ($config->get('post.preview.hover.animation')) { case 'fade': $class = 'hover-fade'; break; case 'direction_aware': $class = 'hover-grid'; break; case 'scale_in': $class = 'hover-scale'; break; default: $class = 'hover-fade'; } return $class; }
/** * Add theme speciffik classes to body. * * @since presscore 1.0 */ function presscore_body_class( $classes ) { global $post; $config = Presscore_Config::get_instance(); $desc_on_hoover = ( 'under_image' != $config->get('description') ); $template = $config->get('template'); $layout = $config->get('layout'); // template classes switch ( $template ) { case 'blog': $classes[] = 'blog'; if ( !of_get_option( 'general-blog_meta_postformat', 1 ) ) { $classes[] = 'post-format-icons-disabled'; } break; case 'portfolio': $classes[] = 'portfolio'; break; case 'team': $classes[] = 'team'; break; case 'testimonials': $classes[] = 'testimonials'; break; case 'archive': $classes[] = 'archive'; break; case 'search': $classes[] = 'search'; break; case 'albums': $classes[] = 'albums'; break; case 'media': $classes[] = 'media'; break; case 'microsite': $classes[] = 'one-page-row'; break; } // layout classes switch ( $layout ) { case 'masonry': if ( $desc_on_hoover ) { $classes[] = 'layout-masonry-grid'; } else { $classes[] = 'layout-masonry'; } break; case 'grid': $classes[] = 'layout-grid'; if ( $desc_on_hoover ) { $classes[] = 'grid-text-hovers'; } break; case 'checkerboard': case 'list': $classes[] = 'layout-list'; break; } // hover classes if ( in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team')) ) { $classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image'; } // hide dividers if content is off if ( in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout') ) { $show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links'); if ( !$show_dividers ) $classes[] = 'description-off'; } if ( is_single() ) { $post_type = get_post_type(); if ( 'dt_portfolio' == $post_type && ( post_password_required() || ( !comments_open() && '0' == get_comments_number() ) ) ) { $classes[] = 'no-comments'; } else if ( 'post' == $post_type && !of_get_option( 'general-blog_meta_postformat', 1 ) ) { $classes[] = 'post-format-icons-disabled'; } } if ( in_array('single-dt_portfolio', $classes) ) { $key = array_search('single-dt_portfolio', $classes); $classes[ $key ] = 'single-portfolio'; } switch ( $config->get('header_background') ) { case 'overlap': $classes['header_background'] = 'overlap'; break; case 'transparent': $classes['header_background'] = 'transparent'; } if ( 'fancy' == $config->get( 'header_title' ) ) { $classes[] = 'fancy-header-on'; } elseif ( 'slideshow' == $config->get( 'header_title' ) ) { $classes[] = 'slideshow-on'; if ( '3d' == $config->get( 'slideshow_mode' ) && 'fullscreen-content' == $config->get( 'slideshow_3d_layout' ) ) { $classes[] = 'threed-fullscreen'; } if ( dt_get_paged_var() > 1 && isset($classes['header_background']) ) { unset($classes['header_background']); } } elseif ( is_single() && 'disabled' == $config->get( 'header_title' ) ) { $classes[] = 'title-off'; } // hoover style switch( of_get_option('hoover-style', 'none') ) { case 'grayscale': $classes[] = 'filter-grayscale-static'; break; case 'gray+color': $classes[] = 'filter-grayscale'; break; case 'blur' : $classes[] = 'image-blur'; break; } // add boxed-class to body if ( 'boxed' == of_get_option('general-layout', 'wide') ) { $classes[] = 'boxed-layout'; } if ( !presscore_responsive() ) { $classes[] = 'responsive-off'; } // justified grid if ( $config->get( 'justified_grid' ) ) { $classes[] = 'justified-grid'; } // general style if ( 'minimalistic' == of_get_option('general-style') ) { $classes[] = 'style-minimal'; } // buttons style switch ( of_get_option('buttons-style', 'ios7') ) { case 'flat': $classes[] = 'btn-flat'; break; case '3d': $classes[] = 'btn-3d'; break; case 'ios7': default: $classes[] = 'btn-ios'; break; } return array_values( array_unique( $classes ) ); }
function presscore_body_class($classes) { $config = Presscore_Config::get_instance(); $desc_on_hoover = 'under_image' != $config->get('post.preview.description.style'); $template = $config->get('template'); $layout = $config->get('layout'); /////////////////////// // template classes // /////////////////////// switch ($template) { case 'blog': $classes[] = 'blog'; break; case 'portfolio': $classes[] = 'portfolio'; break; case 'team': $classes[] = 'team'; break; case 'testimonials': $classes[] = 'testimonials'; break; case 'archive': $classes[] = 'archive'; break; case 'search': $classes[] = 'search'; break; case 'albums': $classes[] = 'albums'; break; case 'media': $classes[] = 'media'; break; case 'microsite': $classes[] = 'one-page-row'; break; } ///////////////////// // layout classes // ///////////////////// switch ($layout) { case 'masonry': if ($desc_on_hoover) { $classes[] = 'layout-masonry-grid'; } else { $classes[] = 'layout-masonry'; } break; case 'grid': $classes[] = 'layout-grid'; if ($desc_on_hoover) { $classes[] = 'grid-text-hovers'; } break; case 'checkerboard': case 'list': case 'right_list': $classes[] = 'layout-list'; break; } //////////////////// // hover classes // //////////////////// if (in_array($layout, array('masonry', 'grid')) && !in_array($template, array('testimonials', 'team'))) { $classes[] = $desc_on_hoover ? 'description-on-hover' : 'description-under-image'; } ////////////////////////////////////// // hide dividers if content is off // ////////////////////////////////////// if (in_array($config->get('template'), array('albums', 'portfolio')) && 'masonry' == $config->get('layout')) { $show_dividers = $config->get('show_titles') || $config->get('show_details') || $config->get('show_excerpts') || $config->get('show_terms') || $config->get('show_links'); if (!$show_dividers) { $classes[] = 'description-off'; } } ///////////////////// // single classes // ///////////////////// if (is_single()) { if (post_password_required() || !comments_open() && '0' == get_comments_number()) { $classes[] = 'no-comments'; } $post_type = get_post_type(); if ('dt_gallery' == $post_type && 'photo_scroller' == $config->get('post.media.type')) { $classes[] = 'photo-scroller-album'; } } ///////////////////////////////// // fix single portfolio class // ///////////////////////////////// if (in_array('single-dt_portfolio', $classes)) { $key = array_search('single-dt_portfolio', $classes); $classes[$key] = 'single-portfolio'; } //////////////////////// // header background // //////////////////////// if ('background' == $config->get('page_title.background.mode') || in_array($config->get('header_title'), array('fancy', 'slideshow'))) { switch ($config->get('header_background')) { case 'overlap': $classes['header_background'] = 'overlap'; break; case 'transparent': $classes['header_background'] = 'transparent'; break; } if ('disabled' == $config->get('header.transparent.background.style')) { $classes[] = 'disabled-transparent-bg'; } } /////////////////// // header title // /////////////////// if ('fancy' == $config->get('header_title')) { $classes[] = 'fancy-header-on'; } elseif ('slideshow' == $config->get('header_title')) { $classes[] = 'slideshow-on'; if ('3d' == $config->get('slideshow_mode') && 'fullscreen-content' == $config->get('slideshow_3d_layout')) { $classes[] = 'threed-fullscreen'; } if (dt_get_paged_var() > 1 && isset($classes['header_background'])) { unset($classes['header_background']); } } elseif (is_single() && 'disabled' == $config->get('header_title')) { $classes[] = 'title-off'; } /////////////////// // hover style // /////////////////// switch ($config->get('template.images.hover.style')) { case 'grayscale': $classes[] = 'filter-grayscale-static'; break; case 'gray+color': $classes[] = 'filter-grayscale'; break; case 'blur': $classes[] = 'image-blur'; break; case 'scale': $classes[] = 'scale-on-hover'; break; } //////////// // boxed // //////////// if ('boxed' == $config->get('template.layout')) { $classes[] = 'boxed-layout'; } ///////////////////// // responsiveness // ///////////////////// if (!presscore_responsive()) { $classes[] = 'responsive-off'; } ///////////////////// // justified grid // ///////////////////// if ($config->get('justified_grid')) { $classes[] = 'justified-grid'; } //////////////////// // header layout // //////////////////// if ('side' == $config->get('header.layout')) { switch ($config->get('header.layout.side.menu.position')) { case 'right': $classes[] = 'header-side-right'; break; default: $classes[] = 'header-side-left'; } } ////////////////////// // accent gradient // ////////////////////// if ('gradient' == $config->get('template.accent.color.mode')) { $classes[] = 'accent-gradient'; } ////////////////////////////// // srcset based hd images // ////////////////////////////// if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) { $classes[] = 'srcset-enabled'; } //////////////////// // buttons style // //////////////////// switch ($config->get('buttons.style')) { case '3d': $classes[] = 'btn-3d'; break; case 'flat': $classes[] = 'btn-flat'; break; case 'ios7': default: $classes[] = 'btn-ios'; break; } if ($config->get('template.footer.background.slideout_mode')) { $classes[] = 'footer-overlap'; } ///////////////////// // general style // ///////////////////// switch ($config->get('template.style')) { case 'minimalistic': $classes[] = 'style-minimal'; break; case 'ios7': $classes[] = 'style-ios'; break; } ///////////////////// // floating menu // ///////////////////// if ($config->get('header.floating_menu.show')) { switch ($config->get('floating_menu.animation')) { case 'fade': $classes[] = 'phantom-fade'; break; case 'slide': $classes[] = 'phantom-slide'; break; } } ///////////// // return // ///////////// return array_values(array_unique($classes)); }
protected function setup_config(&$attributes) { $config = Presscore_Config::get_instance(); $config->set('layout', 'grid'); $config->set('template', 'portfolio'); $config->set('load_style', 'default'); $config->set('justified_grid', true); $config->set('all_the_same_width', true); $config->set('post.preview.buttons.details.enabled', false); $config->set('post.preview.background.enabled', false); $config->set('post.preview.background.style', false); $config->set('image_layout', $attributes['proportion'] ? 'resize' : 'original'); $config->set('thumb_proportions', $attributes['proportion']); $config->set('target_height', $attributes['target_height']); $config->set('item_padding', $attributes['padding']); $config->set('post.preview.description.style', $attributes['descriptions']); $config->set('post.preview.description.alignment', $attributes['content_aligment']); $config->set('post.preview.hover.animation', $attributes['hover_animation']); $config->set('post.preview.hover.color', $attributes['hover_bg_color']); $config->set('post.preview.hover.content.visibility', $attributes['hover_content_visibility']); $config->set('post.preview.load.effect', $attributes['loading_effect'], 'fade_in'); $config->set('show_links', $attributes['show_link']); $config->set('show_titles', $attributes['show_title']); $config->set('show_details', $attributes['show_details']); $config->set('show_excerpts', $attributes['show_excerpt']); $config->set('show_zoom', $attributes['show_zoom']); $config->set('hide_last_row', $attributes['hide_last_row']); $config->set('post.meta.fields.date', $attributes['show_date']); $config->set('post.meta.fields.categories', $attributes['show_categories']); $config->set('post.meta.fields.comments', $attributes['show_comments']); $config->set('post.meta.fields.author', $attributes['show_author']); }
/** * @return Presscore_Config */ function presscore_get_config() { return Presscore_Config::get_instance(); }
/** * PressCore dt_paginator args filter. * * @param array $args Paginator args. * @return array Filtered $args. */ function presscore_dt_paginator_args_filter($args) { $config = Presscore_Config::get_instance(); $args['wrap'] = '<div class="%CLASS%" role="navigation"><div class="page-links">%LIST%</div><div class="page-nav">%PREV%%NEXT%</div></div>'; $args['pages_wrap'] = ''; $args['item_wrap'] = '<a href="%HREF%" %CLASS_ACT% data-page-num="%PAGE_NUM%">%TEXT%</a>'; $args['first_wrap'] = '<a href="%HREF%" %CLASS_ACT% data-page-num="%PAGE_NUM%">%FIRST_PAGE%</a>'; $args['last_wrap'] = '<a href="%HREF%" %CLASS_ACT% data-page-num="%PAGE_NUM%">%LAST_PAGE%</a>'; $args['dotleft_wrap'] = '<a href="javascript: void(0);" class="dots">%TEXT%</a>'; $args['dotright_wrap'] = '<a href="javascript: void(0);" class="dots">%TEXT%</a>'; $args['pages_prev_class'] = 'nav-prev'; $args['pages_next_class'] = 'nav-next'; $args['act_class'] = 'act'; $args['next_text'] = _x('Next page', 'paginator', 'the7mk2'); $args['prev_text'] = _x('Prev page', 'paginator', 'the7mk2'); $args['no_next'] = ''; $args['no_prev'] = ''; $args['first_is_first_mode'] = true; $show_all_pages = is_page() ? $config->get('show_all_pages') : '0'; $args['num_pages'] = '0' == $show_all_pages ? 5 : 9999; return $args; }
function presscore_get_page_title_breadcrumbs($args = array()) { $config = Presscore_Config::get_instance(); $breadcrumbs_class = 'breadcrumbs text-small'; switch ($config->get('page_title.breadcrumbs.background.mode')) { case 'black': $breadcrumbs_class .= ' bg-dark breadcrumbs-bg'; break; case 'white': $breadcrumbs_class .= ' bg-light breadcrumbs-bg'; break; } $default_args = array('beforeBreadcrumbs' => '<div class="wf-td">', 'afterBreadcrumbs' => '</div>', 'listAttr' => ' class="' . $breadcrumbs_class . '"'); $args = wp_parse_args($args, $default_args); return presscore_get_breadcrumbs($args); }
protected function setup_config(&$attributes) { $config = Presscore_Config::get_instance(); $config->set('template', 'albums'); $config->set('load_style', 'default'); $config->set('template.layout.type', 'masonry'); $config->set('post.preview.buttons.details.enabled', false); $config->set('justified_grid', false); $config->set('layout', $attributes['type']); $config->set('image_layout', $attributes['proportion'] ? 'resize' : 'original'); $config->set('thumb_proportions', $attributes['proportion']); $config->set('all_the_same_width', $attributes['same_width']); $config->set('show_titles', $attributes['show_title']); $config->set('show_excerpts', $attributes['show_excerpt']); $config->set('template.columns.number', $attributes['columns']); $config->set('post.preview.width.min', $attributes['column_width']); $config->set('item_padding', $attributes['padding']); if ('under_image' == $attributes['descriptions']) { $config->set('post.preview.background.enabled', !in_array($attributes['bg_under_albums'], array('disabled', ''))); $config->set('post.preview.background.style', $attributes['bg_under_albums']); } else { $config->set('post.preview.background.enabled', false); $config->set('post.preview.background.style', false); } $config->set('post.preview.description.style', $attributes['descriptions']); $config->set('post.preview.description.alignment', $attributes['content_aligment']); $config->set('post.preview.hover.animation', $attributes['hover_animation']); $config->set('post.preview.hover.color', $attributes['hover_bg_color']); $config->set('post.preview.hover.content.visibility', $attributes['hover_content_visibility']); $config->set('post.preview.load.effect', $attributes['loading_effect'], 'fade_in'); $config->set('post.preview.mini_images.enabled', $attributes['show_miniatures']); $config->set('post.meta.fields.media_number', $attributes['show_media_count']); $config->set('post.meta.fields.date', $attributes['show_date']); $config->set('post.meta.fields.categories', $attributes['show_categories']); $config->set('post.meta.fields.comments', $attributes['show_comments']); $config->set('post.meta.fields.author', $attributes['show_author']); }
/** * Slideshow controller. * */ function presscore_slideshow_controller() { global $post; $config = Presscore_Config::get_instance(); if ('slideshow' != $config->get('header_title')) { return; } $slider_id = $config->get('slideshow_sliders'); // turn off regular titles and breadcrumbs remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16); if (dt_get_paged_var() > 1) { return; } switch ($config->get('slideshow_mode')) { case 'porthole': $class = 'fixed' == $config->get('slideshow_layout') ? 'class="fixed" ' : ''; $height = absint($config->get('slideshow_slider_height')); $width = absint($config->get('slideshow_slider_width')); if (!$height) { $height = 500; } if (!$width) { $width = 1200; } printf('<div id="main-slideshow" %sdata-width="%d" data-height="%d" data-autoslide="%d" data-scale="%s" data-paused="%s"></div>', $class, $width, $height, absint($config->get('slideshow_autoslide_interval')), 'fit' == $config->get('slideshow_slider_scaling') ? 'fit' : 'fill', 'paused' == $config->get('slideshow_autoplay') ? 'true' : 'false'); add_action('wp_footer', 'presscore_render_porthole_slider_data', 15); break; case 'photo_scroller': $slides = array(); $slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id($slider_id); // prepare data if ($slideshow->have_posts()) { while ($slideshow->have_posts()) { $slideshow->the_post(); $media_items = get_post_meta($post->ID, '_dt_slider_media_items', true); if (empty($media_items)) { continue; } $slides = array_merge($slides, $media_items); } wp_reset_postdata(); } $photo_scroller = new Presscore_PhotoScroller($slides, array('wrap_class' => 'fullscreen' == $config->get('slideshow.photo_scroller.layout') ? 'fullscreen-scroller' : '', 'background_color' => $config->get('slideshow.photo_scroller.background.color'), 'padding_top' => $config->get('slideshow.photo_scroller.padding.top'), 'padding_bottom' => $config->get('slideshow.photo_scroller.padding.bottom'), 'padding_side' => $config->get('slideshow.photo_scroller.padding.side'), 'autoplay' => 'play' == $config->get('slideshow.photo_scroller.autoplay.mode'), 'autoplay_speed' => $config->get('slideshow.photo_scroller.autoplay.speed'), 'thumbnails_visibility' => $config->get('slideshow.photo_scroller.thumbnails.visibility'), 'thumbnails_width' => $config->get('slideshow.photo_scroller.thumbnail.width'), 'thumbnails_height' => $config->get('slideshow.photo_scroller.thumbnail.height'), 'portrait_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.portrait.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.portrait.fill.mobile')), 'landscape_images_view' => array('max_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.max'), 'min_width' => $config->get('slideshow.photo_scroller.behavior.landscape.width.min'), 'fill_desktop' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.desktop'), 'fill_mobile' => $config->get('slideshow.photo_scroller.behavior.landscape.fill.mobile')), 'inactive_opacity' => $config->get('slideshow.photo_scroller.inactive.opacity'), 'show_overlay' => $config->get('slideshow.photo_scroller.overlay.enabled'), 'show_post_navigation' => false, 'show_share_buttons' => false)); if ($photo_scroller->have_slides()) { echo $photo_scroller->get_html(); } break; /* case 'metro': $slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id( $slider_id ); // prepare data if ( $slideshow->have_posts() ) { $slideshow_objects = array(); while ( $slideshow->have_posts() ) { $slideshow->the_post(); $media_items = get_post_meta( $post->ID, '_dt_slider_media_items', true ); if ( empty($media_items) ) { continue; } $attachments_data = presscore_get_attachment_post_data( $media_items ); if ( count($attachments_data) > 1 ) { $object = array(); foreach ( $attachments_data as $array ) { $object[] = Presscoe_Inc_Classes_SwapperSlider::array_to_object( $array ); } } else { $object = Presscoe_Inc_Classes_SwapperSlider::array_to_object( current($attachments_data) ); } $slideshow_objects[] = $object; } wp_reset_postdata(); echo Presscoe_Inc_Classes_SwapperSlider::get_html( $slideshow_objects ); } break; */ /* case 'metro': $slideshow = Presscore_Inc_Slideshow_Post_Type::get_by_id( $slider_id ); // prepare data if ( $slideshow->have_posts() ) { $slideshow_objects = array(); while ( $slideshow->have_posts() ) { $slideshow->the_post(); $media_items = get_post_meta( $post->ID, '_dt_slider_media_items', true ); if ( empty($media_items) ) { continue; } $attachments_data = presscore_get_attachment_post_data( $media_items ); if ( count($attachments_data) > 1 ) { $object = array(); foreach ( $attachments_data as $array ) { $object[] = Presscoe_Inc_Classes_SwapperSlider::array_to_object( $array ); } } else { $object = Presscoe_Inc_Classes_SwapperSlider::array_to_object( current($attachments_data) ); } $slideshow_objects[] = $object; } wp_reset_postdata(); echo Presscoe_Inc_Classes_SwapperSlider::get_html( $slideshow_objects ); } break; */ case '3d': $class = ''; $data_attr = ''; $slider_layout = $config->get('slideshow_3d_layout'); if (in_array($slider_layout, array('prop-fullwidth', 'prop-content-width'))) { $class = 'prop-fullwidth' == $slider_layout ? 'class="fixed-height" ' : 'class="fixed" '; $width = $config->get('slideshow_3d_slider_width'); $height = $config->get('slideshow_3d_slider_height'); $data_attr = sprintf(' data-width="%d" data-height="%d"', $width ? absint($width) : 2500, $height ? absint($height) : 1200); } printf('<div id="main-slideshow" %s><div class="three-d-slider"%s><span id="loading">0</span></div></div>', $class, $data_attr); add_action('wp_footer', 'presscore_render_3d_slider_data', 15); break; case 'revolution': $rev_slider = $config->get('slideshow_revolution_slider'); if ($rev_slider && function_exists('putRevSlider')) { echo '<div id="main-slideshow">'; putRevSlider($rev_slider); echo '</div>'; } break; case 'layer': $layer_slider = $config->get('slideshow_layer_slider'); $layer_bg_and_paddings = $config->get('slideshow_layer_bg_and_paddings'); if ($layer_slider && function_exists('layerslider')) { echo '<div id="main-slideshow"' . ($layer_bg_and_paddings ? ' class="layer-fixed"' : '') . '>'; layerslider($layer_slider); echo '</div>'; } } // switch }
public function shortcode($atts, $content = null) { $attributes = shortcode_atts(array('category' => '', 'number' => '6', 'orderby' => 'recent', 'height' => '270', 'margin_top' => '', 'margin_bottom' => '', 'width' => '', 'lightbox' => ''), $atts); // sanitize attributes $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']); $attributes['orderby'] = in_array($attributes['orderby'], array('recent', 'random')) ? $attributes['orderby'] : 'recent'; $attributes['height'] = absint($attributes['height']); $attributes['width'] = absint($attributes['width']); $attributes['margin_top'] = $attributes['margin_top'] ? intval($attributes['margin_top']) . 'px' : ''; $attributes['margin_bottom'] = $attributes['margin_bottom'] ? intval($attributes['margin_bottom']) . 'px' : ''; // $attributes['arrows'] = apply_filters('dt_sanitize_flag', $attributes['arrows']); $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']); // $attributes['slider_title'] = wp_kses($content, array()); if ('recent' == $attributes['orderby']) { $attributes['orderby'] = 'date'; } elseif ('random' == $attributes['orderby']) { $attributes['orderby'] = 'rand'; } if ($attributes['category']) { $attributes['category'] = explode(',', $attributes['category']); $attributes['category'] = array_map('trim', $attributes['category']); $attributes['select'] = 'only'; } else { $attributes['select'] = 'all'; } $attachments_ids = array(); // get albums $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1))); if ($dt_query->have_posts()) { // take albums id foreach ($dt_query->posts as $dt_post) { $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true); if ($album_attachments) { $attachments_ids = array_merge($attachments_ids, $album_attachments); } } } // new query to take attachments $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']); $config = Presscore_Config::get_instance(); $slider_class = array('shortcode-instagram'); if ('disabled' == $config->get('sidebar_position')) { $slider_class[] = 'full'; } $slider_style = array(); if ($attributes['margin_bottom']) { $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom']; } if ($attributes['margin_top']) { $slider_style[] = 'margin-top: ' . $attributes['margin_top']; } $slider_fields = array(); /*if ( $attributes['arrows'] ) { $slider_fields[] = 'arrows'; }*/ $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo'); $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons); /*if ( $attributes['slider_title'] ) { $slider_args['title'] = $attributes['slider_title']; }*/ if ($attributes['height']) { $slider_args['height'] = $attributes['height']; } if ($attributes['width']) { $slider_args['img_width'] = $attributes['width']; } $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args); return $output; }
function presscore_populate_post_config($target_post_id = 0) { $config = Presscore_Config::get_instance(); global $post; if ($target_post_id) { $post_id = $target_post_id; } elseif ($post && !empty($post->ID)) { $post_id = $post->ID; } else { return false; } $prefix = '_dt_post_options_'; ///////////////////////// // post preview width // ///////////////////////// if ('list' == presscore_get_current_layout_type()) { $post_preview_media_width = $config->get('post.preview.media.width'); if ($post_preview_media_width >= 100) { $post_preview_width = 'wide'; } else { $post_preview_width = get_post_meta($post_id, "{$prefix}preview", true); } } else { $post_preview_width = get_post_meta($post_id, "{$prefix}preview", true); } $config->set('post.preview.width', $post_preview_width, 'normal'); $config->set('post.preview.gallery.style', get_post_meta($post_id, "{$prefix}preview_style_gallery", true), 'standard_gallery'); $config->set('post.preview.gallery.sideshow.proportions', get_post_meta($post_id, "{$prefix}slider_proportions", true), array('width' => '', 'height' => '')); $config->set('post.preview.video.style', get_post_meta($post_id, "{$prefix}preview_style_video", true), 'image'); return true; }
/** * Get media posts in masonry layout. * */ public static function get_media_masonry_content($ajax_data = array()) { global $post, $wp_query, $paged, $page; extract($ajax_data); if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) { $responce = array('success' => false, 'reason' => 'corrupted data'); } else { /** * Include AQResizer. * */ require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php'; /** * Include helpers. * */ require_once PRESSCORE_DIR . '/helpers.php'; /** * Include template actions and filters. * */ require_once PRESSCORE_DIR . '/template-tags.php'; /** * Include paginator. * */ require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php'; if (!class_exists('Mobile_Detect')) { /** * Mobile detection library. * */ require_once PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php'; } // get page query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page)); $config = Presscore_Config::get_instance(); $config->set('template', 'media'); $config->base_init($post_id); if ($config->get('justified_grid') && isset($sender) && in_array($sender, array('filter', 'paginator'))) { $loaded_items = array(); } $html = ''; $responce = array('success' => true); if (have_posts() && !post_password_required()) { while (have_posts()) { the_post(); // main loop ob_start(); // presscore_post_meta_new_gallery_controller(); do_action('presscore_before_loop'); $page_query = Presscore_Inc_Albums_Post_Type::get_media_template_query(); if ($page_query->have_posts()) { while ($page_query->have_posts()) { $page_query->the_post(); $key_in_loaded = array_search($post->ID, $loaded_items); if (false !== $key_in_loaded) { unset($loaded_items[$key_in_loaded]); continue; } get_template_part('content', 'media'); } wp_reset_postdata(); } $html .= ob_get_clean(); } $next_page_link = dt_get_next_posts_url($page_query->max_num_pages); if ($next_page_link) { $responce['nextPage'] = dt_get_paged_var() + 1; } else { $responce['nextPage'] = 0; } $load_style = $config->get('load_style'); // pagination style if (presscore_is_load_more_pagination()) { $pagination = dt_get_next_page_button($page_query->max_num_pages, 'paginator paginator-more-button with-ajax'); if ($pagination) { $responce['currentPage'] = dt_get_paged_var(); $responce['paginationHtml'] = $pagination; } else { $responce['currentPage'] = $post_paged; } $responce['paginationType'] = 'more'; } else { if ('ajax_pagination' == $load_style) { ob_start(); dt_paginator($page_query, array('class' => 'paginator with-ajax', 'ajaxing' => true)); $pagination = ob_get_clean(); if ($pagination) { $responce['paginationHtml'] = $pagination; } $responce['paginationType'] = 'paginator'; } } $responce['itemsToDelete'] = array_values($loaded_items); // $responce['query'] = $page_query->query; $responce['order'] = $config->get('order'); $responce['orderby'] = $config->get('orderby'); } // main loop $responce['html'] = $html; } $responce = json_encode($responce); // responce output header("Content-Type: application/json"); echo $responce; // IMPORTANT: don't forget to "exit" exit; }
function presscore_congif_populate_media_vars() { $config = Presscore_Config::get_instance(); $post_id = $config->get('post_id'); //////////////////// // posts filter // //////////////////// $prefix = '_dt_media_options_'; $config->set('order', get_post_meta($post_id, "{$prefix}order", true)); $config->set('orderby', get_post_meta($post_id, "{$prefix}orderby", true)); $config->set('display', get_post_meta($post_id, "_dt_albums_media_display", true)); $config->set('posts_per_page', get_post_meta($post_id, "{$prefix}ppp", true)); ////////////// // layout // ////////////// $config->set('layout', get_post_meta($post_id, "{$prefix}layout", true), 'masonry'); $config->set('item_padding', get_post_meta($post_id, "{$prefix}item_padding", true), 20); ////////////// // images // ////////////// $config->set('image_layout', get_post_meta($post_id, "{$prefix}image_layout", true), 'original'); $config->set('thumb_proportions', get_post_meta($post_id, "{$prefix}thumb_proportions", true), array('width' => 1, 'height' => 1)); ///////////////////////// // titles & excerpts // ///////////////////////// $config->set('show_excerpts', get_post_meta($post_id, "{$prefix}show_exerpts", true), true); $config->set('show_titles', get_post_meta($post_id, "{$prefix}show_titles", true), true); ////////////////////////// // is content visible // ////////////////////////// $config->set('post.preview.content.visible', $config->get('show_titles') || $config->get('show_excerpts')); ////////////////// // load style // ////////////////// $load_style = get_post_meta($post_id, "{$prefix}load_style", true); $load_style = $load_style ? $load_style : 'default'; $hide_last_row = 'default' == $load_style ? get_post_meta($post_id, "{$prefix}hide_last_row", true) : false; $config->set('load_style', $load_style); $config->set('hide_last_row', $hide_last_row, false); $config->set('post.preview.load.effect', get_post_meta($post_id, "{$prefix}load_effect", true), 'fade_in'); ///////////////// // paginator // ///////////////// $config->set('show_all_pages', get_post_meta($post_id, "{$prefix}show_all_pages", true), false); $template_name = dt_get_template_name($post_id, true); if ('template-media.php' == $template_name) { $config->set('post.preview.width.min', get_post_meta($post_id, "{$prefix}target_width", true), 370); $config->set('template.columns.number', get_post_meta($post_id, "{$prefix}columns_number", true), 3); // preview description under image or disabled $config->set('post.preview.description.style', $config->get('post.preview.content.visible') ? 'under_image' : 'disabled'); } else { if ('template-media-jgrid.php' == $template_name) { $config->set('justified_grid', true); $config->set('layout', 'grid'); $config->set('target_height', get_post_meta($post_id, "{$prefix}target_height", true), 250); // preview description on hover centered $config->set('post.preview.description.style', 'on_hoover_centered'); } } /////////////// // content // /////////////// $config->set('full_width', get_post_meta($post_id, "{$prefix}full_width", true), false); }
<?php /** * Portfolio list content. * * @package presscore * @since presscore 0.1 */ // File Security Check if (!defined('ABSPATH')) { exit; } global $post; $config = Presscore_Config::get_instance(); $article_content_layout = presscore_get_template_image_layout($config->get('layout'), $config->get('post.query.var.current_post')); ?> <?php do_action('presscore_before_post'); ?> <article <?php post_class(array('post', 'project-' . $article_content_layout)); ?> > <?php if ('odd' == $article_content_layout || 'wide' == $config->get('post.preview.width')) { // media dt_get_template_part('portfolio/list/portfolio-list-post-media'); // content
/** * Returns class based on title_bg_mode value * * @since 1.0.0 * @return string class */ function presscore_get_page_title_bg_mode_html_class() { $config = Presscore_Config::get_instance(); switch ($config->get('page_title.background.mode')) { case 'background': $class = 'solid-bg'; break; case 'gradient': $class = 'gradient-bg'; break; case 'fullwidth_line': $class = 'full-width-line'; break; case 'transparent_bg': $class = 'transparent-bg'; break; case 'disabled': $class = 'disabled-bg'; break; default: $class = ''; } return $class; }