Beispiel #1
0
function thb_breadcrumb()
{
    global $post, $wp_query;
    $id = $wp_query->get_queried_object_id();
    echo '<aside class="breadcrumb">';
    if (!is_front_page()) {
        echo '<a href="';
        echo home_url();
        echo '">' . __('Home', THB_THEME_NAME);
        echo "</a>";
    }
    if (is_singular('portfolio')) {
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
        echo '<span>/</span>' . get_the_title();
    }
    if (is_home()) {
        echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join(' ', $parents);
        echo '<span>/</span>' . get_the_title();
    }
    if (is_single() && !is_singular('portfolio')) {
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
            }
            echo '<span>/</span>' . join(', ', $cats);
        }
        echo '<span>/</span>' . thb_ShortenText(get_the_title(), 40);
    }
    if (is_archive()) {
        if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
            echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
        } else {
            echo '<span>/</span>' . thb_which_archive();
        }
    }
    if (is_search()) {
        echo '<span>/</span>' . thb_which_archive();
    }
    echo '</aside>';
}
Beispiel #2
0
function be_adjacent_post_link($format, $link = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true, $taxonomy = 'category')
{
    if ($previous && is_attachment()) {
        $post =& get_post($GLOBALS['post']->post_parent);
    } else {
        $post = be_get_adjacent_post($in_same_cat, $excluded_categories, $previous, $taxonomy);
    }
    if (!$post) {
        return;
    }
    $title = $post->post_title;
    if (empty($post->post_title)) {
        $title = $previous ? __('Previous Post', THB_THEME_NAME) : __('Next Post', THB_THEME_NAME);
    }
    $title = thb_ShortenText(get_the_title($post->ID), 35);
    $image_id = get_post_thumbnail_id($post->ID);
    $image_link = wp_get_attachment_image_src($image_id, 'full');
    $image = aq_resize($image_link[0], 100, 100, true, false);
    $image_title = esc_attr(get_the_title($post->ID));
    $image = '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" title="' . $image_title . '" />';
    $date = mysql2date(get_option('date_format'), $post->post_date);
    $rel = $previous ? 'prev' : 'next';
    $string = '<a href="' . get_permalink($post) . '" rel="' . $rel . '" data-id="' . $post->ID . '" class="' . $rel . '">';
    $link = str_replace('%title', $title, $link);
    $link = str_replace('%image', $image, $link);
    $link = $string . $link . '</a>';
    $format = str_replace('%link', $link, $format);
    $adjacent = $previous ? 'previous' : 'next';
    echo apply_filters("{$adjacent}_post_link", $format, $link);
}
Beispiel #3
0
function thb_product($atts, $content = null)
{
    extract(shortcode_atts(array('product_sort' => 'best-sellers', 'carousel' => 'no', 'item_count' => '4', 'columns' => '4', 'cat' => '', 'product_ids' => ''), $atts));
    global $post, $product, $woocommerce, $woocommerce_loop;
    $args = array();
    if ($product_sort == "latest-products") {
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
    } else {
        if ($product_sort == "featured-products") {
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count);
        } else {
            if ($product_sort == "top-rated") {
                add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
                $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
                $args['meta_query'] = $woocommerce->query->get_meta_query();
            } else {
                if ($product_sort == "sale-products") {
                    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_query' => array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric')));
                } else {
                    if ($product_sort == "by-category") {
                        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $cat, 'posts_per_page' => $item_count);
                    } else {
                        if ($product_sort == "by-id") {
                            $product_id_array = explode(',', $product_ids);
                            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array);
                        } else {
                            $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value');
                        }
                    }
                }
            }
        }
    }
    $products = new WP_Query($args);
    $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', $columns);
    ob_start();
    switch ($columns) {
        case 2:
            $col = 'medium-6';
            break;
        case 3:
            $col = 'medium-4';
            break;
        case 4:
            $col = 'medium-3';
            break;
    }
    $catalog_mode = ot_get_option('shop_catalog_mode', 'off');
    if ($products->have_posts()) {
        ?>
	   
		<?php 
        if ($carousel == "yes") {
            ?>
			
			<div class="carousel-container">
				<div class="carousel products owl row" data-columns="<?php 
            echo $columns;
            ?>
" data-navigation="true">				
					
					<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
							<?php 
                $product = wc_get_product($products->post->ID);
                ?>
							<article itemscope itemtype="<?php 
                echo woocommerce_get_product_schema();
                ?>
" <?php 
                post_class("post small-6 {$col} columns");
                ?>
>
							
							<?php 
                do_action('woocommerce_before_shop_loop_item');
                ?>
							
								<figure class="fresco">
								
									<?php 
                $image_html = "";
                if (thb_out_of_stock()) {
                    echo '<span class="badge out-of-stock">' . __('Out of Stock', THB_THEME_NAME) . '</span>';
                } else {
                    if ($product->is_on_sale()) {
                        echo apply_filters('woocommerce_sale_flash', '<span class="badge onsale">' . __('Sale', THB_THEME_NAME) . '</span>', $post, $product);
                    }
                }
                if (has_post_thumbnail()) {
                    $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
                }
                ?>
									<?php 
                echo $image_html;
                ?>
			
									<div class="overlay">
										<div class="buttons">
											<?php 
                echo thb_wishlist_button();
                ?>
											<a class="quick quick-view" data-id="<?php 
                echo $post->ID;
                ?>
" href="#"><i class="icon-budicon-545"></i></a>
										</div>
									</div>
										
								</figure>
								
								<div class="post-title<?php 
                if ($catalog_mode == 'on') {
                    echo ' catalog-mode';
                }
                ?>
">
									<a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo thb_ShortenText(get_the_title($post->ID), 20);
                ?>
</a>
									<?php 
                if ($catalog_mode != 'on') {
                    ?>
										<?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     *
                     * @hooked woocommerce_template_loop_price - 10
                     */
                    do_action('woocommerce_after_shop_loop_item_title');
                    ?>
										<?php 
                    do_action('woocommerce_after_shop_loop_item');
                    ?>
									<?php 
                }
                ?>
								</div>
							</article><!-- end product -->
					
						<?php 
            }
            // end of the loop.
            ?>
										
				</div>
			</div>
			
		<?php 
        } else {
            ?>
 
			
		<div class="products row" data-equal="article">
		
			<?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
				<?php 
                $product = wc_get_product($products->post->ID);
                ?>
				<article itemscope itemtype="<?php 
                echo woocommerce_get_product_schema();
                ?>
" <?php 
                post_class("post small-6 {$col} columns");
                ?>
>
				
				<?php 
                do_action('woocommerce_before_shop_loop_item');
                ?>
				
					<figure class="fresco">
					
						<?php 
                $image_html = "";
                if (thb_out_of_stock()) {
                    echo '<span class="badge out-of-stock">' . __('Out of Stock', THB_THEME_NAME) . '</span>';
                } else {
                    if ($product->is_on_sale()) {
                        echo apply_filters('woocommerce_sale_flash', '<span class="badge onsale">' . __('Sale', THB_THEME_NAME) . '</span>', $post, $product);
                    }
                }
                if (has_post_thumbnail()) {
                    $image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
                }
                ?>
						<?php 
                echo $image_html;
                ?>
			
						<div class="overlay">
							<div class="buttons">
								<?php 
                echo thb_wishlist_button();
                ?>
								<a class="quick quick-view" data-id="<?php 
                echo $post->ID;
                ?>
" href="#"><i class="icon-budicon-545"></i></a>
							</div>
						</div>
							
					</figure>
					
					<div class="post-title<?php 
                if ($catalog_mode == 'on') {
                    echo ' catalog-mode';
                }
                ?>
">
						<a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo thb_ShortenText(get_the_title($post->ID), 25);
                ?>
</a>
						<?php 
                if ($catalog_mode != 'on') {
                    ?>
							<?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     *
                     * @hooked woocommerce_template_loop_price - 10
                     */
                    do_action('woocommerce_after_shop_loop_item_title');
                    ?>
							<?php 
                    do_action('woocommerce_after_shop_loop_item');
                    ?>
						<?php 
                }
                ?>
					</div>
				</article><!-- end product -->
		
			<?php 
            }
            // end of the loop.
            ?>
		 
		</div>
		
		<?php 
        }
        ?>
	   
	<?php 
    }
    $out = ob_get_contents();
    if (ob_get_contents()) {
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    remove_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
    return $out;
}
?>
				<a class="quick quick-view" data-id="<?php 
echo $post->ID;
?>
" href="#"><i class="icon-budicon-545"></i></a>
			</div>
		</div>
			
	</figure>
	
	<div class="post-title">
		<a href="<?php 
the_permalink();
?>
"><?php 
echo thb_ShortenText(get_the_title($post->ID), 22);
?>
</a>
		<?php 
if ($catalog_mode != 'on') {
    ?>
			<?php 
    /**
     * woocommerce_after_shop_loop_item_title hook
     *
     * @hooked woocommerce_template_loop_price - 10
     */
    do_action('woocommerce_after_shop_loop_item_title');
    ?>
			<?php 
    do_action('woocommerce_after_shop_loop_item');
Beispiel #5
0
function thb_masonry($atts, $content = null)
{
    extract(shortcode_atts(array('type' => 'post', 'item_count' => '4', 'retrieve' => '3', 'portfolio_categories' => false, 'post_categories' => false), $atts));
    $rand = rand(0, 1000);
    ob_start();
    if ($type == 'post') {
        $args = array('showposts' => $item_count, 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'category__in' => explode(',', $post_categories));
        $posts = new WP_Query($args);
        if ($posts->have_posts()) {
            ?>
  		
  		<section class="blog masonry row" data-loadmore="#loadmore-<?php 
            echo $rand;
            ?>
">
  		
  			<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
  				<article <?php 
                post_class('small-4 columns post item');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
  				  <?php 
                // The following determines what the post format is and shows the correct file accordingly
                $format = get_post_format();
                if ($format) {
                    $gallery_columns = 1;
                    $masonry = 1;
                    include locate_template('inc/postformats/' . $format . '.php');
                } else {
                    include locate_template('inc/postformats/standard.php');
                }
                ?>
  				  <?php 
                if (!in_array($format, array('quote', 'link'))) {
                    ?>
  				    <div class="post-title">
  				    	<h2><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
  				    </div>
  				    <div class="post-content">
  				    	<?php 
                    echo thb_ShortenText(get_the_content(), 200);
                    ?>
  				    </div>
  				  	<?php 
                    get_template_part('inc/postformats/post-meta-masonry');
                    ?>
  					<?php 
                }
                ?>
  				</article>
  			<?php 
            }
            // end of the loop.
            ?>
  		  
  		  
  		</section>
  		<a class="masonry_btn" href="#" id="loadmore-<?php 
            echo $rand;
            ?>
" data-type="<?php 
            echo $type;
            ?>
" data-loading="<?php 
            _e('Loading Posts', THB_THEME_NAME);
            ?>
" data-nomore="<?php 
            _e('No More Posts to Show', THB_THEME_NAME);
            ?>
" data-initial="<?php 
            echo $item_count;
            ?>
" data-count="<?php 
            echo $retrieve;
            ?>
"><?php 
            _e('Load More', THB_THEME_NAME);
            ?>
</a>
  	<?php 
        }
    } else {
        if ($type == 'portfolio') {
            $args = array('showposts' => $item_count, 'nopaging' => 0, 'post_type' => 'portfolio', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'tax_query' => array(array('taxonomy' => 'project-category', 'field' => 'id', 'terms' => explode(',', $portfolio_categories), 'operator' => 'IN')));
            $posts = new WP_Query($args);
            if ($posts->have_posts()) {
                ?>
			
			<section class="thb-portfolio masonry row" data-loadmore="#loadmore-<?php 
                echo $rand;
                ?>
">
			
				<?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    ?>
					<?php 
                    $id = get_the_ID();
                    $image_id = get_post_thumbnail_id();
                    $image_link = wp_get_attachment_image_src($image_id, 'full');
                    $image = aq_resize($image_link[0], 390, null, true, false);
                    $image_title = esc_attr(get_the_title($id));
                    $portfolio_type = get_post_meta($id, 'portfolio_type', true);
                    $meta = get_the_term_list($id, 'project-category', '<span>', '</span>, <span>', '</span>');
                    $meta = preg_replace('/<a href=\\"(.*?)\\">(.*?)<\\/a>/', "\\2", $meta);
                    ?>
					<article <?php 
                    post_class('post small-12 medium-4 columns item');
                    ?>
 id="post-<?php 
                    the_ID();
                    ?>
">
						<figure class="post-gallery fresco">
							<img src="<?php 
                    echo $image[0];
                    ?>
" width="<?php 
                    echo $image[1];
                    ?>
" height="<?php 
                    echo $image[2];
                    ?>
" title="<?php 
                    echo $image_title;
                    ?>
" />
							<?php 
                    if ($portfolio_type == "video") {
                        $video_url = get_post_meta($id, 'portfolio_video', TRUE);
                    }
                    ?>
							<?php 
                    switch ($portfolio_type) {
                        case "link":
                            ?>
									<?php 
                            $link = get_post_meta($id, 'portfolio_link', TRUE);
                            ?>
									<div class="overlay">
										<div class="buttons"><a href="<?php 
                            echo $link;
                            ?>
" class="details" target="blank"><?php 
                            _e('<i class="icon-budicon-343"></i>', THB_THEME_NAME);
                            ?>
</a></div>
								<?php 
                            break;
                        case "image":
                        case "standard":
                            ?>
									<div class="overlay">
										<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a>
										<a href="<?php 
                            echo $image_link[0];
                            ?>
" class="zoom" rel="magnific" title="<?php 
                            the_title();
                            ?>
"><?php 
                            _e('<i class="icon-budicon-545"></i>', THB_THEME_NAME);
                            ?>
</a></div>
								<?php 
                            break;
                        case "gallery":
                            ?>
									<div class="overlay">
										<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a></div>
								<?php 
                            break;
                        case "video":
                            ?>
									<div class="overlay">
										<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a>
										<a href="<?php 
                            echo $video_url;
                            ?>
" class="zoom video" rel="magnific" title="<?php 
                            the_title();
                            ?>
"><?php 
                            _e('<i class="icon-budicon-189"></i>', THB_THEME_NAME);
                            ?>
</a></div>
									
								<?php 
                            break;
                    }
                    ?>
								<div class="overlay-title">
									<h4><?php 
                    if ($portfolio_type != 'link') {
                        ?>
<a href="<?php 
                        the_permalink();
                        ?>
" rel="bookmark"><?php 
                        the_title();
                        ?>
</a><?php 
                    } else {
                        the_title();
                    }
                    ?>
</h4>
									<aside class="post_categories"><?php 
                    echo $meta;
                    ?>
</aside>
								</div>
							</div>
						</figure>
					</article>
				<?php 
                }
                // end of the loop.
                ?>
			  
			  
			</section>
			<a class="masonry_btn" href="#" id="loadmore-<?php 
                echo $rand;
                ?>
" data-type="<?php 
                echo $type;
                ?>
" data-loading="<?php 
                _e('Loading Posts', THB_THEME_NAME);
                ?>
" data-nomore="<?php 
                _e('No More Posts to Show', THB_THEME_NAME);
                ?>
" data-initial="<?php 
                echo $item_count;
                ?>
" data-count="<?php 
                echo $retrieve;
                ?>
" data-categories="<?php 
                echo $portfolio_categories;
                ?>
"><?php 
                _e('Load More', THB_THEME_NAME);
                ?>
</a>
		<?php 
            }
        }
    }
    $out = ob_get_contents();
    if (ob_get_contents()) {
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    return $out;
}
Beispiel #6
0
function load_more_posts()
{
    $initial = $_POST['initial'];
    $count = $_POST['count'];
    $page = $_POST['page'];
    $type = $_POST['type'];
    $list = isset($_POST['list']) ? $_POST['list'] : false;
    $categories = isset($_POST['categories']) ? $_POST['categories'] : '';
    $offset = ($page - 1) * $count + $initial;
    if ($type == 'post') {
        $args = array('offset' => $offset, 'posts_per_page' => $count, 'orderby' => 'post_date', 'order' => 'DESC', 'ignore_sticky_posts' => '1', 'suppress_filters' => true);
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                ?>
		    	<?php 
                if ($list) {
                    ?>
		    		<?php 
                    $image_id = get_post_thumbnail_id();
                    $image_link = wp_get_attachment_image_src($image_id, 'full');
                    $image = aq_resize($image_link[0], 755, 385, true, false);
                    // Blog
                    ?>
		    		<article <?php 
                    post_class('post');
                    ?>
 id="post-<?php 
                    the_ID();
                    ?>
">
		    			<div class="hover-image" style="background-image:url('<?php 
                    echo $image[0];
                    ?>
');"></div>
		    			<div class="row center-text">
		    			 <div class="small-12 medium-8 medium-centered columns">
		    					<?php 
                    get_template_part('inc/postformats/post-dateauthor');
                    ?>
		    					<header class="post-title">
		    						<h2 itemprop="headline"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
		    					</header>
		    					<?php 
                    get_template_part('inc/postformats/post-meta');
                    ?>
		    				
		    					<div class="post-content center-text">
		    						<?php 
                    echo thb_excerpt(300, '...');
                    ?>
		    						<div class="center-text">
		    							<a href="<?php 
                    the_permalink();
                    ?>
" class="more-link"><span><i class="icon-budicon-447"></i></span> <?php 
                    _e('Read More', THB_THEME_NAME);
                    ?>
</a>
		    						</div>
		    					</div>
		    				</div>
		    			</div>
		    		</article>
		    	<?php 
                } else {
                    ?>
		       <article <?php 
                    post_class('small-4 columns post item');
                    ?>
 id="post-<?php 
                    the_ID();
                    ?>
">
		         <?php 
                    // The following determines what the post format is and shows the correct file accordingly
                    $format = get_post_format();
                    if ($format) {
                        $gallery_columns = 1;
                        $masonry = 1;
                        include locate_template('inc/postformats/' . $format . '.php');
                    } else {
                        include locate_template('inc/postformats/standard.php');
                    }
                    ?>
		         <?php 
                    if (!in_array($format, array('quote', 'link'))) {
                        ?>
		           <div class="post-title">
		           	<h2><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h2>
		           </div>
		           <div class="post-content">
		           	<?php 
                        echo thb_ShortenText(get_the_content(), 200);
                        ?>
		           </div>
		         	<?php 
                        get_template_part('inc/postformats/post-meta-masonry');
                        ?>
		       	<?php 
                    }
                    ?>
		       </article>
		    	<?php 
                }
                ?>
		    <?php 
            }
        }
    } else {
        if ($type == 'portfolio') {
            $args = array('offset' => $offset, 'posts_per_page' => $count, 'post_type' => 'portfolio', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'tax_query' => array(array('taxonomy' => 'project-category', 'field' => 'id', 'terms' => explode(',', $categories), 'operator' => 'IN')));
            $query = new WP_Query($args);
            if ($query->have_posts()) {
                while ($query->have_posts()) {
                    $query->the_post();
                    ?>
			    <?php 
                    $id = get_the_ID();
                    $image_id = get_post_thumbnail_id();
                    $image_link = wp_get_attachment_image_src($image_id, 'full');
                    $image = aq_resize($image_link[0], 390, null, true, false);
                    $image_title = esc_attr(get_the_title($id));
                    $portfolio_type = get_post_meta($id, 'portfolio_type', true);
                    $meta = get_the_term_list($id, 'project-category', '<span>', '</span>, <span>', '</span>');
                    $meta = preg_replace('/<a href=\\"(.*?)\\">(.*?)<\\/a>/', "\\2", $meta);
                    ?>
			    <article <?php 
                    post_class('post small-4 columns item');
                    ?>
 id="post-<?php 
                    the_ID();
                    ?>
">
			    	<figure class="post-gallery fresco">
			    		<img src="<?php 
                    echo $image[0];
                    ?>
" width="<?php 
                    echo $image[1];
                    ?>
" height="<?php 
                    echo $image[2];
                    ?>
" title="<?php 
                    echo $image_title;
                    ?>
" />
			    		<?php 
                    if ($portfolio_type == "video") {
                        $video_url = get_post_meta($id, 'portfolio_video', TRUE);
                    }
                    ?>
			    		<?php 
                    switch ($portfolio_type) {
                        case "link":
                            ?>
			    				<?php 
                            $link = get_post_meta($id, 'portfolio_link', TRUE);
                            ?>
			    				<div class="overlay">
			    					<div class="buttons"><a href="<?php 
                            echo $link;
                            ?>
" class="details" target="blank"><?php 
                            _e('<i class="icon-budicon-343"></i>', THB_THEME_NAME);
                            ?>
</a></div>
			    			<?php 
                            break;
                        case "image":
                        case "standard":
                            ?>
			    				<div class="overlay">
			    					<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a>
			    					<a href="<?php 
                            echo $image_link[0];
                            ?>
" class="zoom" rel="magnific" title="<?php 
                            the_title();
                            ?>
"><?php 
                            _e('<i class="icon-budicon-545"></i>', THB_THEME_NAME);
                            ?>
</a></div>
			    			<?php 
                            break;
                        case "gallery":
                            ?>
			    				<div class="overlay">
			    					<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a></div>
			    			<?php 
                            break;
                        case "video":
                            ?>
			    				<div class="overlay">
			    					<div class="buttons"><a href="<?php 
                            the_permalink();
                            ?>
" class="details"><?php 
                            _e('<i class="icon-budicon-496"></i>', THB_THEME_NAME);
                            ?>
</a>
			    					<a href="<?php 
                            echo $video_url;
                            ?>
" class="zoom video" rel="magnific" title="<?php 
                            the_title();
                            ?>
"><?php 
                            _e('<i class="icon-budicon-189"></i>', THB_THEME_NAME);
                            ?>
</a></div>
			    				
			    			<?php 
                            break;
                    }
                    ?>
			    			<div class="overlay-title">
			    				<h4><?php 
                    if ($portfolio_type != 'link') {
                        ?>
<a href="<?php 
                        the_permalink();
                        ?>
" rel="bookmark"><?php 
                        the_title();
                        ?>
</a><?php 
                    } else {
                        the_title();
                    }
                    ?>
</h4>
			    				<aside class="post_categories"><?php 
                    echo $meta;
                    ?>
</aside>
			    			</div>
			    		</div>
			    	</figure>
			    </article>
		    
 				<?php 
                }
            }
        }
    }
    die;
}
            ?>
		    <div class="post-title">
		    	<h2><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h2>
		    </div>
		    <div class="post-content">
		    	<?php 
            echo thb_ShortenText(get_the_content(), 200);
            ?>
		    </div>
		  	<?php 
            get_template_part('inc/postformats/post-meta-masonry');
            ?>
	  	<?php 
        }
        ?>
	  </article>
	  
	  
  <?php 
    }
    ?>
  	
Beispiel #8
0
function thb_post($atts, $content = null)
{
    extract(shortcode_atts(array('carousel' => 'no', 'item_count' => '3', 'columns' => '3'), $atts));
    $args = array('showposts' => $item_count, 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'suppress_filters' => 0);
    $posts = new WP_Query($args);
    ob_start();
    if ($posts->have_posts()) {
        ?>
	  <?php 
        switch ($columns) {
            case 2:
                $col = 'large-6';
                $w = '570';
                break;
            case 3:
                $col = 'large-4';
                $w = '370';
                break;
            case 4:
                $col = 'large-3';
                $w = '270';
                break;
        }
        ?>
		<?php 
        if ($carousel == "yes") {
            ?>
			
				<div class="carousel posts owl row" data-columns="<?php 
            echo $columns;
            ?>
" data-navigation="true" data-bgcheck="false">				
					
					<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
						<article <?php 
                post_class('post small-12 ' . $col . ' columns');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
							<?php 
                $masonry = 0;
                include locate_template('inc/postformats/image.php');
                ?>
							  <div class="post-title">
							  	<h2><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
							  </div>
							  <div class="post-content">
							  	<?php 
                echo thb_ShortenText(get_the_content(), 200);
                ?>
							  </div>
								<?php 
                get_template_part('inc/postformats/post-meta-masonry');
                ?>
						</article>
					<?php 
            }
            // end of the loop.
            ?>
	 
										
				</div>
			
		<?php 
        } else {
            ?>
 
		<div class="masonry posts row" data-equal="article">
		
			<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
				<article <?php 
                post_class('small-12 medium-6 ' . $col . ' columns post item grid-sizer');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
					<figure class="post-gallery">
						<?php 
                $image_id = get_post_thumbnail_id();
                $image_link = wp_get_attachment_image_src($image_id, 'full');
                $image = aq_resize($image_link[0], 400, 150, true, false);
                // Blog
                ?>
						<a href="<?php 
                the_permalink();
                ?>
"><img src="<?php 
                echo $image[0];
                ?>
" width="<?php 
                echo $image[1];
                ?>
" height="<?php 
                echo $image[2];
                ?>
" /></a>
					</figure>
				    <header class="post-title">
				    	<h2 itemprop="headline"><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
				    </header>
				    <aside class="post-meta cf">
				    	<ul>
				    		<li><?php 
                _e("By", THB_THEME_NAME);
                ?>
 <?php 
                the_author_posts_link();
                ?>
</li>
				    		<li><time class="author" datetime="<?php 
                echo esc_attr(get_the_date('c'));
                ?>
"><?php 
                echo thb_human_time_diff_enhanced();
                ?>
</time></li>
				    	</ul>
				    </aside>
				    <div class="post-content">
				    	<?php 
                echo thb_ShortenText(get_the_content(), 150);
                ?>
				    </div>
				    <a href="<?php 
                the_permalink();
                ?>
" class="more-link"><?php 
                _e('Read More', THB_THEME_NAME);
                ?>
</a>
				</article>
			<?php 
            }
            // end of the loop.
            ?>
		 
		</div>
		
		<?php 
        }
        ?>
	   
	<?php 
    }
    $out = ob_get_contents();
    if (ob_get_contents()) {
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    return $out;
}
Beispiel #9
0
function thb_post($atts, $content = null)
{
    extract(shortcode_atts(array('carousel' => 'no', 'item_count' => '9', 'columns' => '4'), $atts));
    $args = array('showposts' => $item_count, 'nopaging' => 0, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'suppress_filters' => 0);
    $posts = new WP_Query($args);
    ob_start();
    if ($posts->have_posts()) {
        ?>
	  <?php 
        switch ($columns) {
            case 2:
                $col = 'medium-6';
                $w = '570';
                break;
            case 3:
                $col = 'medium-4';
                $w = '370';
                break;
            case 4:
                $col = 'medium-3';
                $w = '270';
                break;
        }
        ?>
		<?php 
        if ($carousel == "yes") {
            ?>
			
				<div class="carousel posts owl row" data-columns="<?php 
            echo $columns;
            ?>
" data-navigation="true" data-bgcheck="false">				
					
					<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
						<article <?php 
                post_class('post ' . $col . ' columns');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
							<?php 
                $masonry = 0;
                include locate_template('inc/postformats/image.php');
                ?>
							  <div class="post-title">
							  	<h2><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
							  </div>
							  <div class="post-content">
							  	<?php 
                echo thb_ShortenText(get_the_content(), 200);
                ?>
							  </div>
								<?php 
                get_template_part('inc/postformats/post-meta-masonry');
                ?>
						</article>
					<?php 
            }
            // end of the loop.
            ?>
	 
										
				</div>
			
		<?php 
        } else {
            ?>
 
		<div class="masonry posts row" data-equal="article">
		
			<?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
				<article <?php 
                post_class('small-4 columns post item');
                ?>
 id="post-<?php 
                the_ID();
                ?>
">
				  <?php 
                $masonry = 0;
                include locate_template('inc/postformats/image.php');
                ?>
				    <div class="post-title">
				    	<h2><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
				    </div>
				    <div class="post-content">
				    	<?php 
                echo thb_ShortenText(get_the_content(), 200);
                ?>
				    </div>
				  	<?php 
                get_template_part('inc/postformats/post-meta-masonry');
                ?>
				</article>
			<?php 
            }
            // end of the loop.
            ?>
		 
		</div>
		
		<?php 
        }
        ?>
	   
	<?php 
    }
    $out = ob_get_contents();
    if (ob_get_contents()) {
        ob_end_clean();
    }
    wp_reset_query();
    wp_reset_postdata();
    return $out;
}