示例#1
0
        echo $folio_url;
        ?>
</a>
                        </div>
                    <?php 
    }
    ?>
                    
                    
                    <?php 
    if (tx_folio_term('portfolio-category')) {
        ?>
                    	<div class="folio-cat">
                        	<span class="genericon genericon-category"></span>
							<span class="folio-categories"><?php 
        echo tx_folio_term('portfolio-category');
        ?>
</span>
                        </div>
                    <?php 
    }
    ?>
    
					</div>
                    
					<div class="entry-content">
						<?php 
    the_content();
    ?>
						<?php 
    wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'i-max') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
示例#2
0
function tx_portfolio_function($atts, $content = null)
{
    $atts = shortcode_atts(array('style' => 'default', 'items' => 4, 'columns' => 4, 'hide_cat' => 'no', 'hide_excerpt' => 'no', 'show_pagination' => 'no', 'carousel' => 'no', 'blog_term' => ''), $atts);
    $style_class = '';
    $posts_per_page = intval($atts['items']);
    $total_column = intval($atts['columns']);
    $tx_carousel = $atts['carousel'];
    $width = 600;
    $height = 480;
    if ($atts['style'] == 'gallery') {
        $style_class = 'folio-style-gallery';
    }
    $return_string = '';
    if ($tx_carousel == 'no') {
        $return_string .= '<div class="tx-portfolio tx-post-row tx-masonry ' . $style_class . '">';
    } else {
        $return_string .= '<div class="tx-portfolio tx-post-row tx-carousel" data-columns="' . $total_column . '">';
    }
    $cat_slug = '';
    if (!empty($atts['blog_term'])) {
        $cat_slug = $atts['blog_term'];
    }
    wp_reset_query();
    global $post;
    $args = array('posts_per_page' => $posts_per_page, 'post_type' => 'portfolio', 'orderby' => 'date', 'order' => 'DESC', 'portfolio-category' => $cat_slug);
    if ($atts['show_pagination'] == 'yes' && $atts['carousel'] == 'no') {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $args['paged'] = $paged;
        $args['prev_text'] = __('&laquo;', 'tx');
        $args['next_text'] = __('&raquo;', 'tx');
    }
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $thumb_image_url = aq_resize($thumb_image_url[0], $width, $height, true, true, true);
            $return_string .= '<div class="tx-portfolio-item tx-post-col-' . $total_column . '"><div class="tx-border-box">';
            if (has_post_thumbnail()) {
                // check if the post has a Post Thumbnail assigned to it.
                $return_string .= '<div class="tx-folio-img">';
                $return_string .= '<div class="tx-folio-img-wrap"><img src="' . esc_url($thumb_image_url) . '" alt="" class="folio-img" /></div>';
                $return_string .= '<div class="folio-links"><span>';
                $return_string .= '<a href="' . esc_url(get_permalink()) . '" class="folio-linkico"><i class="fa fa-link"></i></a>';
                $return_string .= '<a href="' . esc_url($full_image_url[0]) . '" class="tx-colorbox folio-zoomico"><i class="fa fa-search-plus"></i></a>';
                $return_string .= '</span></div>';
                $return_string .= '</div>';
            }
            $return_string .= '<span class="folio-head">';
            $return_string .= '<h3 class="tx-folio-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
            if ($atts['hide_cat'] == 'no') {
                // check if the post has a Post Thumbnail assigned to it.
                $return_string .= '<div class="tx-folio-category">' . tx_folio_term('portfolio-category') . '</div>';
            } else {
                $return_string .= '<div style="display: block; clear: both; height: 16px;"></div>';
            }
            $return_string .= '</span>';
            if ($atts['hide_excerpt'] == 'no' && $atts['style'] != 'gallery') {
                // check if the post has a Post Thumbnail assigned to it.
                $return_string .= '<div class="tx-folio-content">' . get_the_excerpt() . '</div>';
            }
            $return_string .= '</div></div>';
        }
    } else {
        $return_string .= '<p>Sorry, no posts matched your criteria.</p>';
    }
    $return_string .= '</div>';
    if ($atts['show_pagination'] == 'yes' && $atts['carousel'] == 'no') {
        $return_string .= '<div class="nx-paging"><div class="nx-paging-inner">' . paginate_links($args) . '</div></div>';
    }
    wp_reset_query();
    return $return_string;
}