/**
     * post shortcode
     *
     * Options: Show all post / by Category
     *
     */
    function wpsp_post_shortcode($atts, $content = null)
    {
        ob_start();
        extract(shortcode_atts(array('term_id' => null, 'post_format' => null, 'post_meta' => null, 'post_excerpt' => null, 'post_style' => null, 'post_offset' => null, 'post_count' => null, 'cols' => null), $atts));
        //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        $args = array();
        if ($post_format != 'post-format-standard') {
            $args = array('tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array($post_format), 'operator' => 'IN')));
        }
        if ($post_offset != '') {
            $args = array('offset' => $post_offset);
        }
        $defaults = array('post_type' => 'post', 'category__in' => $term_id, 'posts_per_page' => $post_count, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote', 'post-format-audio', 'post-format-gallery', 'post-format-image', 'post-format-link', 'post-format-video'), 'operator' => 'NOT IN')));
        $args = wp_parse_args($args, $defaults);
        extract($args);
        $post_query = new WP_Query($args);
        if ($post_query->have_posts()) {
            ?>
		<div class="wpsp-row clearfix">
		<?php 
            while ($post_query->have_posts()) {
                $post_query->the_post();
                ?>
		<?php 
                // entry-class
                $entry_classes = array('entry-blog-article');
                $entry_classes[] = $post_style;
                $entry_classes[] = 'col';
                $entry_classes[] = wpsp_grid_class($cols);
                ?>
	
				<article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class($entry_classes);
                ?>
>
				<?php 
                if ('overlay-2' == $post_style) {
                    ?>
					<div class="post-thumbnail-wrap overlay-2">
						<div class="post-thumbnail"><?php 
                    wpsp_get_post_thumbnail('thumb-full');
                    ?>
</div>
						<div class="caption-wrap">
							<div class="caption-inner">
							<a href="<?php 
                    wpsp_permalink();
                    ?>
" title="<?php 
                    echo wpsp_esc_title();
                    ?>
" rel="bookmark"><span class="title"><?php 
                    the_title();
                    ?>
</span></a>
							</div>
						</div>
					</div>
				<?php 
                } else {
                    ?>
	
					<?php 
                    printf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_permalink(), wpsp_get_esc_title(), wpsp_post_thumbnail('thumb-full'));
                    ?>
					<div class="entry-post-content-wrap">
						<div class="entry-blog-content">
						<?php 
                    get_template_part('template-parts/blog/blog-entry-title');
                    ?>
	
						<?php 
                    if ($post_meta) {
                        get_template_part('template-parts/blog/blog-entry-meta');
                    }
                    ?>
						</div>
						<?php 
                    if ($post_excerpt) {
                        get_template_part('template-parts/blog/blog-entry-excerpt');
                    }
                    ?>
					</div> <!-- .entry-post-content-wrap -->
				<?php 
                }
                ?>
		
				</article><!-- #post-## -->
		<?php 
            }
            wp_reset_postdata();
            ?>
		</div>

		<?php 
            // Pagination
            /* if(function_exists('wp_pagenavi'))
                   wp_pagenavi();
               else 
                   wpsp_paging_nav($post_query->max_num_pages); */
            ?>
	<?php 
        } else {
            echo esc_html__('Sorry, new content will coming soon.', 'learninginstitute');
        }
        return ob_get_clean();
    }
 function wpsp_get_post_thumbnail($size = 'thumbnail')
 {
     echo wpsp_post_thumbnail($size);
 }
					'order' => 'DESC',
					'hide_empty' => 0
				);
 
			$terms = get_terms( 'portfolio_tag', $args );*/
if (!empty($terms) && !is_wp_error($terms)) {
    ?>
			<div class="portfolio-term-wrap wpsp-row clearfix">
				<?php 
    $term_list = '';
    foreach ((array) $terms as $term) {
        $term_list .= '<article class="portfolio-entry-article post-highlight col span_1_of_3">';
        if (!empty($term->image_id)) {
            $term_list .= sprintf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', esc_url(get_term_link($term)), esc_attr(sprintf(__('View all post filed under %s', 'learninginstitute'), $term->name)), wp_get_attachment_image($term->image_id, 'thumb-landscape'));
        } else {
            $term_list .= sprintf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', esc_url(get_term_link($term)), esc_html($term->name), wpsp_post_thumbnail('thumb-landscape'));
        }
        $term_list .= '<div class="portfolio-entry-content">';
        $term_list .= '<h3 class="entry-title portfolio-entry-title">';
        $term_list .= '<a href="' . esc_url(get_term_link($term)) . '" alt="' . esc_attr(sprintf(__('View all post filed under %s', 'learninginstitute'), $term->name)) . '">' . esc_html(sprintf(__('Projects in %s', 'learninginstitute'), $term->name)) . '</a>';
        $term_list .= '</h3>';
        if (!empty($term->description)) {
            $term_list .= '<div class="portfolio-entry-excerpt">' . $term->description . '</div>';
        }
        $term_list .= '</div>';
        $term_list .= '</article>';
    }
    echo $term_list;
    ?>
			</div> <!-- .wpsp-row .clearfix -->		
			<?php 
<?php

/**
 * Template part for displaying portfolio thumbnail.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Learning_Institute
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
?>


<?php 
printf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_permalink(), wpsp_get_esc_title(), wpsp_post_thumbnail('thumb-landscape'));
示例#5
0
$args = array('post_type' => 'post', 'posts_per_page' => 1, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'IN')));
$video_post_query = new WP_Query($args);
if ($video_post_query->have_posts()) {
    while ($video_post_query->have_posts()) {
        $video_post_query->the_post();
        ?>

	<section class="latest-video-wrap">
		<div class="container">
			<div <?php 
        post_class(array('latest-video', 'wpsp-row', 'clearfix'));
        ?>
>
			<div class="col span_1_of_2">
				<?php 
        printf('<div class="post-thumbnail"><a class="popup-youtube" itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_post_video(), wpsp_get_esc_title(), wpsp_post_thumbnail('blog-post'));
        ?>
			</div>
			<div class="col span_1_of_2">
				<?php 
        get_template_part('template-parts/blog/blog-entry-title');
        ?>
				<?php 
        get_template_part('template-parts/blog/blog-entry-meta');
        ?>
				<?php 
        get_template_part('template-parts/blog/blog-entry-excerpt');
        ?>
			</div>
			</div> <!-- .latest-video -->
		</div> <!-- .container -->