$blog_query = new WP_Query($args);
?>
                    
                    <?php 
if ($blog_query->have_posts()) {
    ?>
						<section class="blog-main text-center" role="main">							
						<?php 
    while ($blog_query->have_posts()) {
        $blog_query->the_post();
        get_template_part("article", "loop");
    }
    ?>
							<div class="list-pagition text-center">
								<?php 
    magee_native_pagenavi("echo", $blog_query);
    ?>
	
							</div>
						</section>
                    <?php 
}
?>
                    <?php 
wp_reset_postdata();
?>
					</div>
                   <?php 
if ($layout['sidebar'] == "left-sidebar" || $layout['sidebar'] == "right-sidebar") {
    ?>
					<div class="col-md-3 <?php 
示例#2
0
			<div class="container">
				<div class="row">
					<div class="col-md-9">
                    <?php 
if (have_posts()) {
    ?>
						<section class="blog-main text-center" role="main">					
						<?php 
    while (have_posts()) {
        the_post();
        get_template_part("article", "loop");
    }
    ?>
							<div class="list-pagition text-center">
								<?php 
    magee_native_pagenavi("echo", $wp_query);
    ?>
	
							</div>
						</section>
                    <?php 
}
?>
					</div>
					<div class="col-md-3">
						<aside class="blog-side text-left">
							<div class="widget-area">
							<?php 
magee_get_sidebar('default_sidebar');
?>
							</div>
/**
 * Shortcode: portfolio filter
 *
 * @param string $content
 * @param array $atts Shortcode attributes
 * @return string Output html
 * author: quan
 */
function magee_portfolio_filter_shortcode($atts, $content = NULL)
{
    extract(shortcode_atts(array('css_class' => '', 'num' => '9', 'columns' => '3', 'filter' => '1', 'pagenav' => '0'), $atts));
    global $paged;
    $return = '<div class="magee-shortcode portfolio-grid-wrapper">';
    $items = '';
    $portfolio_terms = get_terms("portfolio-category");
    $count = count($portfolio_terms);
    if ($count > 0 && $filter == '1') {
        $return .= '<nav id="filters" class="portfolio-filter text-center controls"><ul>';
        $return .= '<li class="filter active all" data-filter = "all"><a  href="javascript:;" title="">' . __("All", "magee") . '</a></li>';
        foreach ($portfolio_terms as $portfolio_term) {
            $termname = $portfolio_term->slug;
            $return .= '<li class="filter" data-filter = ".portfolio-' . $termname . '"><a href="javascript:;" >' . $portfolio_term->name . '</a></li>';
        }
        $return .= '</ul></nav>';
    }
    $return .= '<section class="portfolio-list-main" role="main">';
    $term_slug = isset($term->slug) ? $term->slug : "";
    if (!is_numeric($columns) || $columns < 2 || $columns > 4) {
        $columns = 4;
    }
    $i = 1;
    $col = 12 / $columns;
    if (!$paged) {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    }
    $query = new WP_Query('post_type=portfolio&paged=' . $paged . '&orderby=menu_order&post_status=publish&posts_per_page=' . $num);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $postid = get_the_ID();
            $permalink = get_permalink();
            $title = get_the_title();
            $image = "";
            $term_list = wp_get_post_terms($postid, 'portfolio-category', array("fields" => "all"));
            if (has_post_thumbnail($postid)) {
                $thumb = get_the_post_thumbnail($postid, "portfolio-grid-thumb");
                $image = wp_get_attachment_image_src(get_post_thumbnail_id($postid), 'large');
            }
            $items .= '<div class="mix  col-md-' . $col . ' col-sm-6 ' . $css_class . ' portfolio-' . $term_list[0]->slug . '" data-category="portfolio-' . $term_list[0]->slug . '">
 
 <figure class="portfolio-list-box">
								' . $thumb . '
								<figcaption>
									<a href="' . $permalink . '"><h3>' . $title . '</h3></a>
									' . get_the_excerpt() . '
								</figcaption>
							</figure>
</div>';
            $i++;
        }
    }
    $return .= $items . '<div class="clear"></div></section>';
    if ($pagenav == "yes" || $pagenav == "1") {
        $return .= '<div class="list-pagition text-center">' . magee_native_pagenavi("return", $query) . '</div>';
    }
    $return .= '</div>';
    wp_reset_postdata();
    return $return;
}