function sc_blog($atts, $content = NULL)
{
    extract(shortcode_atts(array('section_title' => '', 'items_number' => 6, 'include_categories' => '', 'exclude_posts' => '', 'clear_wrapper_margin' => 'true'), $atts));
    $safe_items_number = intval($items_number) <= 0 ? -1 : intval($items_number);
    $include_categs = !empty($include_categories) ? $include_categories : '';
    $exclude_posts = !empty($exclude_posts) ? $exclude_posts : '';
    $args = array('posts_per_page' => $safe_items_number, 'cat' => $include_categs, 'post__not_in' => $exclude_posts);
    $class_margin = '';
    if ($clear_wrapper_margin == 'true') {
        $class_margin = ' clear-wrapper-margin';
    }
    $postz = new WP_query($args);
    $output = '';
    if (!empty($section_title)) {
        $output .= '<h1 class="title-widget">' . esc_attr($section_title) . '</h1>';
    }
    if (!$postz->have_posts()) {
        $output .= '<div class="alert alert-danger">' . __('No entries found!', 'kazaz') . '</div>';
    } else {
        $output .= '<div class="row gutter k-equal-height' . $class_margin . '">';
        // start loop...
        while ($postz->have_posts()) {
            $postz->the_post();
            $output .= '<div class="news-mini-wrap col-lg-6 col-md-6">';
            if (has_post_thumbnail() && !post_password_required() && !is_attachment()) {
                $output .= '<figure class="news-featured-image">';
                $output .= '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">' . get_the_post_thumbnail(get_the_ID(), 'full') . '</a>';
                $output .= '</figure>';
            }
            $output .= '<h1 class="page-title">';
            $output .= '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">' . esc_attr(get_the_title()) . '</a>';
            $output .= '</h1>';
            $output .= k_post_meta(0);
            $output .= '<div class="news-summary">';
            if (has_excerpt()) {
                $output .= '<p>' . get_the_excerpt() . '</p>';
            } else {
                $output .= '<p>' . wp_trim_excerpt() . '</p>';
            }
            $output .= '</div>';
            $output .= '</div>';
        }
        // loop ends
        $output .= '</div>';
        $output .= k_pagination(0);
        wp_reset_query();
        // reset query
        return $output;
    }
}
Esempio n. 2
0
		<h1 class="page-title">
			<a href="<?php 
    the_permalink();
    ?>
" rel="bookmark" title="<?php 
    the_title_attribute(array('before' => 'Permalink to: ', 'after' => ''));
    ?>
"><?php 
    the_title();
    ?>
</a>
		</h1>
		
		<?php 
    if (get_post_type() == 'post') {
        k_post_meta();
    } elseif (get_post_type() == 'event' || get_post_type() == 'course' || get_post_type() == 'gallery') {
        echo k_cpt_meta();
    }
    // print info
    ?>
		
		<div class="news-summary">
	
    	<?php 
    // print excerpt - if any, otherwise trim it up automatically
    if (has_excerpt()) {
        the_excerpt();
    } else {
        echo '<p>' . wp_trim_excerpt() . '</p>';
    }