Exemple #1
0
function waxom_blog_carousel($atts, $content = null)
{
    $posts_nr = $ids = $lightbox = $nav = $nav_position = $dots = $margin = $cols = $autoplay = $thumb_space = $style = $excerpt = $carousel_title = $cats = '';
    extract(shortcode_atts(array("posts_nr" => '', "cats" => '', "ids" => '', "lightbox" => '', "nav" => 'false', "nav_position" => 'bottom', "dots" => 'true', "dots_align" => 'center', "margin" => 30, "cols" => 3, "autoplay" => 'true', "thumb_space" => 'yes', "style" => 'boxed', "hover_style" => 'light', "style_meta" => 'minimal', "excerpt" => 'yes', "carousel_title" => 'Latest News', "view_all" => 'View All'), $atts));
    wp_enqueue_script('owl-carousel', '', '', '', true);
    wp_enqueue_style('owl-carousel');
    $margin = 30;
    if ($thumb_space == 'no') {
        $margin = 0;
    }
    ob_start();
    echo '<div class="vntd-carousel-holder">';
    if ($carousel_title) {
        echo '<div class="vntd-carousel-title"><h2>' . esc_textarea($carousel_title);
        if ($view_all) {
            echo '<span>/ <a href="' . get_permalink(get_option('page_for_posts')) . '">' . esc_textarea($view_all) . '</a></span>';
        }
        echo '</h2></div>';
    }
    echo '<div class="vntd-carousel vntd-blog-carousel vntd-blog blog-style-' . esc_attr($style) . ' blog-meta-' . esc_attr($style_meta) . ' carousel-nav-' . $nav . ' nav-position-' . esc_attr($nav_position) . ' blog-hover-style-' . esc_attr($hover_style) . ' carousel-dots-align-' . esc_attr($dots_align) . '" data-cols="' . $cols . '" data-autoplay="' . esc_attr($autoplay) . '" data-margin="' . $margin . '" data-dots="' . $dots . '" data-nav="' . $nav . '">';
    wp_reset_postdata();
    $args = array('posts_per_page' => 8, 'cat' => $cats, 'orderby' => 'slug');
    $the_query = new WP_Query($args);
    $i = 0;
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            //if(!has_post_thumbnail() && $style != "minimal") continue;
            $i++;
            $size = 'vntd-portfolio-square';
            if ($style == "thumb_bg") {
                $size = "vntd-sidebar-landscape";
            }
            $img_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $size);
            $thumb_url = $img_url[0];
            ?>
		<div class="item">

			<div class="blog-item-inner">
				
				<?php 
            if ($style != "minimal" && has_post_thumbnail()) {
                ?>
				<div class="blog-post-thumbnail">
					<div class="member-image-holder">
						<?php 
                waxom_post_meta_extra();
                ?>
						<a href="<?php 
                echo get_permalink(get_the_ID());
                ?>
">
						<img src="<?php 
                echo esc_url($thumb_url);
                ?>
" alt="<?php 
                the_title();
                ?>
">
						<div class="carousel-post-overlay">
							<div class="fa fa-search"></div>
						</div>
						</a>
						
					</div>
				</div>
				<?php 
            } elseif ($style == "minimal") {
                waxom_post_meta_extra();
            }
            ?>

				<div class="blog-post-details">
				
					<div class="blog-post-details-inner">
						<?php 
            if ($style == "thumb_bg" || $style == "bubble") {
                waxom_post_meta_extra();
            }
            ?>
						<h5 class="blog-post-title">
							<a href="<?php 
            echo get_permalink(get_the_ID());
            ?>
">
							<?php 
            echo get_the_title(get_the_ID());
            ?>
							</a>
						</h5>
						
						<?php 
            waxom_post_meta();
            ?>
				
						<div class="details">
							<?php 
            echo waxom_excerpt(17, true);
            ?>
		
						</div>
						
					</div>
				</div>
			</div>
		</div>	
							
		<?php 
        }
    }
    wp_reset_postdata();
    echo '</div></div>';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Exemple #2
0
function waxom_post_media($blog_style = null, $page_layout = null, $grid_style = null, $masonry = null)
{
    global $post;
    $post_format = get_post_format($post->ID);
    $img_size = 'vntd-sidebar-landscape';
    if ($blog_style == 'timeline') {
        $img_size = 'vntd-sidebar-auto';
    }
    if ($grid_style == "thumb_bg" && $blog_style == "grid" || $blog_style == 'aligned' && $page_layout != 'fullwidth') {
        $img_size = 'vntd-sidebar-square';
    } elseif ($blog_style == 'aligned' && $page_layout == 'fullwidth') {
        $img_size = 'vntd-sidebar-landscape';
    } elseif ($page_layout == 'fullwidth' || $blog_style == 'classic' && $page_layout == 'fullwidth' || $blog_style == 'minimal') {
        $img_size = 'vntd-fullwidth-landscape';
    } elseif ($blog_style == 'grid') {
        if ($masonry == 'yes') {
            $img_size = 'vntd-sidebar-auto';
        } else {
            $img_size = 'vntd-sidebar-square';
        }
    }
    echo '<div class="post-media-container">';
    waxom_post_meta_extra();
    if (!$post_format || $post_format == 'standard' || $post_format == 'quote' || $post_format == 'link' || $post_format == 'gallery' && !get_post_meta($post->ID, 'gallery_images', TRUE) || $blog_style == "grid" && $grid_style == "thumb_bg") {
        wp_enqueue_script('magnific-popup', '', '', '', true);
        // Extra meta item
        $imgurl = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $img_size);
        $post_link = $imgurl[0];
        $extra_class = " mp-image";
        if ($post_format == "link") {
            $post_link = esc_url(get_post_meta($post->ID, 'post_link', true));
            $extra_class = '';
        } elseif ($post_format == "quote") {
            $post_link = get_permalink($post->ID);
            $extra_class = '';
        }
        ?>
	<div class="single_item <?php 
        echo esc_attr($extra_class);
        ?>
">
		<a href="<?php 
        echo esc_url($post_link);
        ?>
" title="<?php 
        echo esc_attr(get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true));
        ?>
">
			<img src="<?php 
        echo esc_url($imgurl[0]);
        ?>
" alt="<?php 
        echo esc_attr(get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true));
        ?>
">
			<?php 
        if ($post_format == 'quote' || $post_format == 'link') {
            ?>
			<div class="blog-post-overlay">
				<div class="post-overlay-inner">
					<div class="post-overlay-title">
						
						<?php 
            if ($post_format == 'quote') {
                echo '<span class="quotation quotation-begin">"</span>' . esc_textarea(get_post_meta($post->ID, 'quote_content', true));
            } else {
                echo get_the_title($post->ID);
            }
            ?>
						<span class="quotation quotation-end">"</span>
					</div>
					<div class="post-overlay-subtitle">
						<?php 
            if ($post_format == 'quote') {
                echo esc_textarea(get_post_meta($post->ID, 'quote_author', true));
            } else {
                echo esc_url(get_post_meta($post->ID, 'post_link', true));
            }
            ?>
					</div>
				</div>
			</div>
			<?php 
        } elseif ($post_format != 'video') {
            ?>
			
			<div class="blog-item-overlay">
				
				<div class="portfolio-overlay-icons">
					<span class="overlay-icon overlay-icon-zoom"><i class="fa fa-search"></i></span>
				</div>
				
			</div>
			
			<?php 
        }
        ?>
		</a>
	</div>
	<?php 
    } elseif ($post_format == 'gallery') {
        wp_enqueue_script('magnific-popup', '', '', '', true);
        wp_enqueue_style('magnific-popup');
        wp_enqueue_script('swiper', '', '', '', true);
        wp_enqueue_style('swiperCSS');
        if ($masonry == 'yes' && $page_layout == 'fullwidth' && $blog_style != 'grid') {
            $img_size = 'vntd-fullwidth-landscape';
        } elseif ($masonry == 'yes' && $blog_style == 'grid') {
            $img_size = 'vntd-sidebar-square';
        }
        ?>

	<div class="vntd-image-slider">

		<ul class="swiper-wrapper mp-gallery">
		
			<?php 
        $gallery_images = get_post_meta($post->ID, 'gallery_images', TRUE);
        if ($gallery_images) {
            $ids = explode(",", $gallery_images);
            foreach ($ids as $id) {
                $imgurl = wp_get_attachment_image_src($id, $img_size);
                echo '<li class="swiper-slide"><a href="' . esc_url($imgurl[0]) . '" title="' . esc_attr(get_post_meta($id, '_wp_attachment_image_alt', true)) . '"><img src="' . esc_url($imgurl[0]) . '" alt="' . esc_attr(get_post_meta($id, '_wp_attachment_image_alt', true)) . '"><div class="blog-item-overlay"><div class="portfolio-overlay-icons"><span class="overlay-icon overlay-icon-zoom" href="#"><i class="fa fa-search"></i></span></div></div></a></li>';
            }
        }
        ?>
		</ul>
		
		<div class="veented-slider-pagination swiper-pagination"></div>	
	</div>
	
	<?php 
    } elseif ($post_format == 'video') {
        if (!get_post_meta($post->ID, 'video_site_url', true)) {
            echo 'No video URL inserted!';
        }
        echo '<div class="video-containers single_item">' . wp_oembed_get(esc_url(get_post_meta($post->ID, 'video_site_url', true))) . '</div>';
    }
    echo '</div>';
}