if ($type == 1) { $output .= '<li class="latest-posts-item clearfix">'; if (has_post_thumbnail() || get_post_format() == 'video' && get_post_meta($post->ID, 'brad_video_poster', true) != '') { if (get_post_format() == 'video' && get_post_meta($post->ID, 'brad_video_poster', true) != '') { $src = wp_get_attachment_image_src(get_post_meta($post->ID, 'brad_video_poster', true), 'thumbnail'); $src2 = wp_get_attachment_image_src(get_post_meta($post->ID, 'brad_video_poster', true), ''); } else { $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); $src2 = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ''); } $output .= '<div class="image"><a href="' . $src2[0] . '" rel="prettyPhoto[slides]" class="block prettyPhoto"><img src="' . $src[0] . '" alt="' . get_the_title() . '" /></a></div>'; } $output .= '<div class="latest-posts-content"><div><h3><a class="title" href="' . get_permalink() . '">' . get_the_title() . '</a></h3><p class="post-meta-data"><span>' . get_the_date() . '</span>' . ($comments != '' && $show_comments == 'yes' ? '<span>' . $comments . '</span>' : '') . '</p>'; if (intval($excerpt_length) > 0) { $output .= '<p class="excerpt">' . brad_limit_words(get_the_excerpt(), intval($excerpt_length)) . '</p>'; } $output .= '</div></div></li>'; } else { $output .= '<li class="latest-posts-item clearfix">'; $output .= '<div class="date"> <span class="month">' . get_the_time('M') . '</span> <span class="day">' . get_the_time('d') . '</span> </div>'; $output .= '<div class="latest-posts-content"><div><h3><a class="title" href="' . get_permalink() . '">' . get_the_title() . '</a></h3><p class="post-meta-data">' . ($comments != '' && $show_comments == 'yes' ? '<span>' . $comments . '</span>' : '') . '</p>'; if (intval($excerpt_length) > 0) { $output .= '<p class="excerpt">' . brad_limit_words(get_the_excerpt(), intval($excerpt_length)) . '</p>'; } $output .= '</div></div></li>'; } } wp_reset_query(); $output .= '</ul></div>' . $this->endBlockComment('Blog List') . "\n"; } echo $output;
function brad_bradslider($atts, $content = null) { global $post, $brad_includes; static $slider_id = 1; $output = ''; extract(shortcode_atts(array('category' => '', 'type' => 'gallery', 'effect' => 'fade', 'post_category' => '', 'order' => 'date', 'orderby' => 'DESC', 'show_excerpt' => 'yes', 'show_categories' => 'yes', 'show_date' => 'yes', 'show_readmore' => 'yes', 'max' => 10, 'excerpt_length' => '20', 'max_width' => '1210px', 'height' => '500', 'fullheight' => 'no', 'swipe' => 'yes', 'parallax' => 'no', 'navigation' => 'yes', 'pagination' => 'yes', 'responsive_height' => 'yes', 'interval' => '5000', 'header_slider' => 'no', 'autoplay' => '0'), $atts)); if ($type == 'post') { $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => (int) $max, 'order' => $order, 'orderby' => $orderby); if (!empty($post_category)) { $cat_id = explode(',', $post_category); $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $cat_id)); } } else { $args = array('post_type' => 'bradslider', 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'menu_order', 'posts_per_page' => -1); if ($category != '') { $cat_slug = explode(',', $category); $args['tax_query'] = array(array('taxonomy' => 'bradslider-category', 'field' => 'slug', 'terms' => $cat_slug)); } } $pagination_lines = ''; $slides_count = 0; $height = intval($height > 0) ? $height : 500; $carousels = new WP_Query($args); if ($carousels->have_posts()) { $style = $parallax_script1 = $parallax_script2 = $parallax_script3 = ''; if ($parallax == 'yes') { $parallax_script2 = ' data-start="transform: translateY(0px); opacity:1;" data-300="transform: translateY(-100px);opacity:0;"'; $parallax_script1 = ' data-start="transform: translateY(0px);" data-1440="transform: translateY(-500px);"'; $parallax_script3 = ' data-start="opacity: 1;" data-300="opacity:0;"'; } if ($fullheight != 'yes') { $style = 'height:' . $height . 'px; max-height:' . $height . 'px;'; } $output .= "<style type='text/css' scoped>#brad_slider{$slider_id} .carousel-caption-content { max-width:{$max_width};}</style>"; $output .= '<div class="brad-slider-wrapper" style="' . $style . '"><div id="brad_slider' . $slider_id . '" class="carousel brad-slider slide ' . $effect . ' fullheight-' . $fullheight . ' header-slider-' . $header_slider . ' navigation-' . $navigation . '" data-height="' . $height . '" data-fullheight=' . $fullheight . ' data-rs-height="' . $responsive_height . '" data-interval="' . $interval . '" " data-swipe="' . $swipe . '" style="' . $style . '"><div class="carousel-preloader"><div class="spinner"></div><img src="' . get_template_directory_uri() . '/images/loader.gif" /></div><div class="carousel-inner parallax-slider-' . $parallax . '" ' . $parallax_script1 . '>'; while ($carousels->have_posts()) { $carousels->the_post(); if ($type == 'post') { if (has_post_thumbnail()) { $slider_title = get_the_title(); $slider_excerpt = brad_limit_words(get_the_excerpt(), intval($excerpt_length)); $slider_date = get_the_date(); $slider_image = wp_get_attachment_image_src(get_post_thumbnail_id(), ''); $slider_btn_link = get_permalink(); $slider_color = get_post_meta($post->ID, 'brad_slider_color', true); $slider_bg_opacity = get_post_meta($post->ID, 'brad_slider_bg_opacity', true); $slider_bg_color = get_post_meta($post->ID, 'brad_slider_bg_color', true); $slider_button_style = get_post_meta($post->ID, 'brad_slider_button_style', true); $slider_style = 'opacity:' . $slider_bg_opacity . '; filter:alpha(opacity=' . intval($slider_bg_opacity * 100) . ');'; $slider_bg_cover = get_post_meta($post->ID, 'brad_slider_bg_cover', true); $slider_bg_repeat = get_post_meta($post->ID, 'brad_slider_bg_repeat', true); $slider_bg_pos = get_post_meta($post->ID, 'brad_slider_bg_pos', true); if ($slider_bg_color != '') { $slider_style .= 'background-color:' . $slider_bg_color . ';'; } $output .= '<div class="item" data-header-scheme="header-scheme-' . $slider_color . '" data-slider-scheme="color-' . $slider_color . '"><div class="image bg-cover-' . $slider_bg_cover . '" style="background-image:url(' . $slider_image[0] . '); background-position:' . $slider_bg_pos . '; background-repeat:' . $slider_bg_repeat . ' " data-kenburn="no"><img src="' . $slider_image[0] . '"></div><div class="slider-bg-overlay" style="' . $slider_style . '"></div><div class="carousel-caption caption-halign-center caption-valign-center color-' . $slider_color . '" ' . $parallax_script2 . ' ><div class="carousel-caption-wrapper"><div class="carousel-caption-content fadeIn"><div class="carousel-caption-inner-content">'; if ($show_date == 'yes' || $show_categories == 'yes') { $output .= '<h6 class="slider-subtitle">'; if ($show_date == 'yes') { $output .= '<span>' . $slider_date . '</span>'; } if ($show_categories == 'yes') { $categories = get_the_category(); $separator = ''; if ($categories) { $output .= '<span>'; foreach ($categories as $category) { $output .= $separator . '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'brad'), $category->name)) . '">' . $category->cat_name . '</a>'; $separator = ' , '; } $output .= '</span>'; } } $output .= '</h6>'; } if ($slider_title != '') { $output .= '<h2 class="slider-title"><span>' . $slider_title . '</span></h2>'; } if ($show_excerpt == 'yes') { $output .= '<div class="slider-content" >' . $slider_excerpt . '</div>'; } if ($show_readmore == 'yes') { $output .= '<div class="slider-buttons"><a href="' . $slider_btn_link . '" class="button button_' . $slider_button_style . ' button_large">' . __('Read More', 'brad') . '</a></div>'; } $output .= '</div></div></div></div></div>'; $pagination_lines .= '<li data-target="#brad_slider' . $slider_id . '" data-slide-to="' . $slides_count . '">'; } } else { $slider_image_id = preg_replace('/[^\\d]/', '', get_post_meta($post->ID, 'brad_slider_image', true)); $slider_image = wp_get_attachment_image_src($slider_image_id, ''); $slider_bg_cover = get_post_meta($post->ID, 'brad_slider_bg_cover', true); $slider_bg_repeat = get_post_meta($post->ID, 'brad_slider_bg_repeat', true); $slider_bg_pos = get_post_meta($post->ID, 'brad_slider_bg_pos', true); $slider_type = get_post_meta($post->ID, 'brad_slider_type', true); $slider_video_mp4 = get_post_meta($post->ID, 'brad_slider_video_mp4', true); $slider_video_ogv = get_post_meta($post->ID, 'brad_slider_video_ogv', true); $slider_video_webm = get_post_meta($post->ID, 'brad_slider_video_webm', true); $slider_video_ratio = get_post_meta($post->ID, 'brad_video_ratio', true); $caption_halign = get_post_meta($post->ID, 'brad_slider_caption_align', true); $caption_valign = get_post_meta($post->ID, 'brad_slider_caption_valign', true); $slider_title = get_post_meta($post->ID, 'brad_slider_title', true); $slider_subtitle = get_post_meta($post->ID, 'brad_slider_subtitle', true); $slider_caption = get_post_meta($post->ID, 'brad_slider_caption', true); $slider_button = get_post_meta($post->ID, 'brad_slider_button', true); $slider_button_style = get_post_meta($post->ID, 'brad_slider_button_style', true); $slider_color = get_post_meta($post->ID, 'brad_slider_color', true); $slider_button_alternate = get_post_meta($post->ID, 'brad_slider_button_alternate', true); $slider_button_style_alternate = get_post_meta($post->ID, 'brad_slider_button_style_alternate', true); $slider_content_width = get_post_meta($post->ID, 'brad_slider_content_width', true); $slider_header_color = get_post_meta($post->ID, 'brad_slider_header_color', true); $slider_effect = get_post_meta($post->ID, 'brad_slider_caption_animation', true); $slider_btn_link = get_post_meta($post->ID, 'brad_slider_btn_link', true); $slider_altbtn_link = get_post_meta($post->ID, 'brad_slider_altbtn_link', true); $slider_bg_opacity = get_post_meta($post->ID, 'brad_slider_bg_opacity', true); $slider_bg_color = get_post_meta($post->ID, 'brad_slider_bg_color', true); $kenburn = get_post_meta($post->ID, 'brad_slider_kenburn', true); $kbpos_start = get_post_meta($post->ID, 'brad_slider_kbpos_start', true); $kbpos_end = get_post_meta($post->ID, 'brad_slider_kbpos_end', true); $kbzoom_start = get_post_meta($post->ID, 'brad_slider_kbzoom_start', true); $kbzoom_end = get_post_meta($post->ID, 'brad_slider_kbzoom_end', true); $kbduration = get_post_meta($post->ID, 'brad_slider_kbduration', true); $slider_style = 'opacity:' . $slider_bg_opacity . '; filter:alpha(opacity=' . intval($slider_bg_opacity * 100) . ');'; if ($slider_bg_color != '') { $slider_style .= 'background-color:' . $slider_bg_color . ';'; } if ($kenburn == 'yes') { $slider_bg_pos = $kbpos_start; } $output .= '<div class="item" data-video-ratio="' . $slider_video_ratio . '" data-header-scheme="header-scheme-' . $slider_header_color . '" data-slider-scheme="color-' . $slider_color . '"><div class="image bg-cover-' . $slider_bg_cover . '" style="background-image:url(' . $slider_image[0] . '); background-position:' . $slider_bg_pos . '; background-repeat:' . $slider_bg_repeat . '" data-kenburn="' . $kenburn . '" data-kbstart="' . $kbpos_start . '" data-kbend="' . $kbpos_end . '" data-kbzoom-start="' . $kbzoom_start . '" data-kbzoom-end="' . $kbzoom_end . '" data-kb-duration="' . $kbduration . '" ><img src="' . $slider_image[0] . '"></div>'; if ($slider_type == 'video' && ($slider_video_mp4 != '' || $slider_video_ogv != '' || $slider_video_webm != '')) { $brad_includes['load_mediaelement'] = true; $output .= '<div class="carousel-video"><video poster="' . $slider_image[0] . '" preload="auto" autoplay loop="loop" muted="muted">'; if ($slider_video_mp4 != "") { $output .= '<source src="' . $slider_video_mp4 . '" type="video/mp4">'; } if ($slider_video_webm != "") { $output .= '<source src="' . $slider_video_webm . '" type="video/webm">'; } if ($slider_video_ogv != "") { $output .= '<source src="' . $slider_video_ogv . '" type="video/ogg">'; } $output .= '</video></div>'; } $output .= '<div class="slider-bg-overlay" style="' . $slider_style . '"></div><div class="carousel-caption caption-halign-' . $caption_halign . ' caption-valign-' . $caption_valign . ' color-' . $slider_color . '"' . $parallax_script2 . ' ><div class="carousel-caption-wrapper"><div class="carousel-caption-content ' . $slider_effect . '"><div class="carousel-caption-inner-content">'; if ($slider_subtitle != '') { $output .= '<h6 class="slider-subtitle">' . $slider_subtitle . '</h6>'; } if ($slider_title != '') { $output .= '<h2 class="slider-title"><span>' . $slider_title . '</span></h2>'; } if ($slider_caption != '') { $output .= '<div class="slider-content" >' . $slider_caption . '</div>'; } if ($slider_button_alternate != '' || $slider_button != '') { $output .= '<div class="slider-buttons">'; if ($slider_button != '') { $output .= '<a href="' . $slider_btn_link . '" class="button button button_' . $slider_button_style . '">' . $slider_button . '</a>'; } if ($slider_button_alternate != '') { $output .= '<a href="' . $slider_altbtn_link . '" class="button button button_' . $slider_button_style_alternate . '">' . $slider_button_alternate . '</a>'; } $output .= '</div>'; } $output .= '</div></div></div></div></div>'; $pagination_lines .= '<li data-target="#brad_slider' . $slider_id . '" data-slide-to="' . $slides_count . '">'; } $slides_count++; } wp_reset_postdata(); $output .= '</div>'; if ($pagination == 'yes') { $output .= '<ol class="carousel-indicators">' . $pagination_lines . '</ol>'; } if ($navigation == 'yes') { $output .= '<a class="left carousel-control" href="#brad_slider' . $slider_id . '" data-slide="prev" ' . $parallax_script3 . '></a><a class="right carousel-control" href="#brad_slider' . $slider_id . '" data-slide="next" ' . $parallax_script3 . '></a>'; } $output .= '</div></div>'; $brad_includes['load_bootstrapCarousel'] = true; } $slider_id++; return $output; }