public static function blog($atts, $content = null)
    {
        extract(shortcode_atts(array('column' => '1/4', 'limit' => '3'), $atts));
        if ($column == '1/2') {
            $count_string = 'two';
        } else {
            if ($column == '1/3') {
                $count_string = 'four';
            } else {
                $count_string = 'three';
            }
        }
        $output = '';
        $query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => intval($limit)));
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $post_title = get_the_title();
                $attr_title = the_title_attribute(array('before' => '', 'after' => '', 'echo' => false));
                $format = get_post_format(get_the_ID());
                $format_css = 'responsive-images';
                if ($format == 'status') {
                    $format_css = 'format-holder status';
                } else {
                    if ($format == 'link') {
                        $format_css = 'format-holder link';
                    } else {
                        if ($format == 'aside') {
                            $format_css = 'format-holder aside';
                        }
                    }
                }
                if ($format != 'gallery') {
                    $post_content = apply_filters('the_content', get_the_content(__('Read More', 'prodo')));
                } else {
                    $post_content = ProdoTheme::postGallery(__('Read More', 'prodo'), false);
                }
                $output .= '
				<article id="post-' . esc_attr(get_the_ID()) . '" class="' . esc_attr(implode(' ', get_post_class('blog-post masonry offsetTopS offsetBottom', get_the_ID()))) . '">
					<header>
						' . (!empty($post_title) ? '<h3><a href="' . esc_url(get_the_permalink()) . '" title="' . $attr_title . '">' . esc_html($post_title) . '</a></h3>' : '') . '
						<div class="info">
							' . ProdoTheme::postCategories(get_the_ID(), '<span>', '</span>', false) . '
						</div>
					</header>
					<div class="responsive-images">
						' . $post_content . '
					</div>
				</article>';
            }
        } else {
            wp_reset_postdata();
            return '';
        }
        wp_reset_postdata();
        return '<div class="row"><div class="col-md-12 col-sm-12 blog-masonry blog-masonry-' . esc_attr($count_string) . '">' . $output . '</div></div>';
    }
Ejemplo n.º 2
0
        the_title();
        ?>
</a></h3>
		<?php 
    }
    ?>
		<?php 
    the_post_thumbnail();
    ?>
		<div class="info">
			<span><?php 
    the_author_link();
    ?>
</span>
			<?php 
    ProdoTheme::postCategories(get_the_ID(), '<span>', '</span>');
    ?>
		</div>
	</header>
<?php 
}
?>

<?php 
if (is_search()) {
    the_excerpt();
} else {
    ?>
<div class="format-holder link">
	<?php 
    the_content(__('Read More', 'prodo'));