/** * Display single album as photoscroller. Disable post title, navigation and meta information. */ function presscore_mod_albums_single_post_photoscroller() { $config = presscore_config(); if (!is_single() || 'dt_gallery' !== get_post_type() || 'photo_scroller' !== $config->get('post.media.type') || post_password_required()) { return ''; } $media_items = $config->get('post.media.library'); if (has_post_thumbnail() && $config->get('post.media.featured_image.enabled')) { array_unshift($media_items, absint(get_post_thumbnail_id())); } $args = array('wrap_class' => 'fullscreen' == $config->get('post.media.photo_scroller.layout') ? 'fullscreen-scroller' : '', 'background_color' => $config->get('post.media.photo_scroller.background.color'), 'padding_top' => $config->get('post.media.photo_scroller.padding.top'), 'padding_bottom' => $config->get('post.media.photo_scroller.padding.bottom'), 'padding_side' => $config->get('post.media.photo_scroller.padding.side'), 'autoplay' => 'play' == $config->get('post.media.photo_scroller.autoplay.mode'), 'autoplay_speed' => $config->get('post.media.photo_scroller.autoplay.speed'), 'thumbnails_visibility' => $config->get('post.media.photo_scroller.thumbnails.visibility'), 'thumbnails_width' => $config->get('post.media.photo_scroller.thumbnail.width'), 'thumbnails_height' => $config->get('post.media.photo_scroller.thumbnail.height'), 'portrait_images_view' => array('max_width' => $config->get('post.media.photo_scroller.behavior.portrait.width.max'), 'min_width' => $config->get('post.media.photo_scroller.behavior.portrait.width.min'), 'fill_desktop' => $config->get('post.media.photo_scroller.behavior.portrait.fill.desktop'), 'fill_mobile' => $config->get('post.media.photo_scroller.behavior.portrait.fill.mobile')), 'landscape_images_view' => array('max_width' => $config->get('post.media.photo_scroller.behavior.landscape.width.max'), 'min_width' => $config->get('post.media.photo_scroller.behavior.landscape.width.min'), 'fill_desktop' => $config->get('post.media.photo_scroller.behavior.landscape.fill.desktop'), 'fill_mobile' => $config->get('post.media.photo_scroller.behavior.landscape.fill.mobile')), 'inactive_opacity' => $config->get('post.media.photo_scroller.inactive.opacity'), 'show_overlay' => $config->get('post.media.photo_scroller.overlay.enabled')); $photo_scroller = new Presscore_PhotoScroller($media_items, $args); if ($photo_scroller->have_slides()) { echo $photo_scroller->get_html(); // do not show post title $config->set('page_title.enabled', false); // do not show post navigation $config->set('post.navigation.arrows.enabled', false); $config->set('post.navigation.back_button.enabled', false); $config->set('post.meta.fields.date', false); $config->set('post.meta.fields.categories', false); $config->set('post.meta.fields.comments', false); $config->set('post.meta.fields.author', false); } }
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 }
/** * 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 }