コード例 #1
0
ファイル: carousel-blog.php プロジェクト: siiiiilvio/kadcnc
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;
}
コード例 #2
0
ファイル: blog-functions.php プロジェクト: siiiiilvio/kadcnc
function waxom_blog_post_content($page_layout = NULL, $blog_style = NULL, $grid_style = NULL, $masonry = NULL)
{
    global $post;
    $post_format = get_post_format($post->ID);
    if (!$post_format) {
        $post_format = 'standard';
    }
    $extra_classes = array();
    $excerpt_size = 50;
    $grid_style = 'simple';
    if (is_null($grid_style)) {
        $grid_style = waxom_option('blog_grid_style');
    }
    if (is_null($blog_style)) {
        $blog_style = 'classic';
    }
    if ($blog_style == "grid" || $blog_style == "timeline") {
        $extra_classes = array('item', 'vntd-grid-item');
        $excerpt_size = 20;
        if (waxom_option('blog_grid_style') == 'thumb_bg') {
            if (!has_post_thumbnail()) {
                return null;
            }
            $excerpt_size = 18;
        }
    } elseif ($blog_style == "minimal") {
        $excerpt_size = 30;
    }
    $post_media_class = 'post-no-media';
    if (has_post_thumbnail()) {
        $post_media_class = 'post-has-media';
    }
    array_push($extra_classes, $post_media_class);
    if (!$masonry) {
        $masonry = waxom_option('blog_masonry');
        if ($masonry == true) {
            $masonry = 'yes';
        }
    }
    ?>
	
	<div <?php 
    post_class($extra_classes);
    ?>
>
	
		<div class="blog-post-wrap">
	
		<?php 
    if (has_post_thumbnail()) {
        waxom_post_media($blog_style, $page_layout, $grid_style, $masonry);
    }
    ?>
	
		
		<div class="blog-post-inner">
			<div class="post-inner">

			<!-- Post Header -->
			<div class="blog-head">
				<h2 class="blog-post-title">
					<a href="<?php 
    echo get_permalink($post->ID);
    ?>
">
					<?php 
    echo get_the_title($post->ID);
    ?>
					</a>
				</h2>
			</div>
			<!-- Post Header -->
			
			<?php 
    waxom_post_meta();
    ?>
	
			<!-- Post Details -->
			<div class="details">
				<?php 
    if (!is_single()) {
        echo waxom_excerpt($excerpt_size, true);
    }
    ?>
		
			</div>
			<!-- End Post Details -->
			
			</div>
		</div>
		
		<div class="blog-post-content-wrap">
		<?php 
    if (is_single()) {
        the_content();
    }
    ?>
		
		</div>
		
		</div>
		
	</div>
		
	<?php 
}