function archives_excerpt() { $length = get_theme_mod('excerpt_length', 20); if ($length && intval($length) >= 5 && intval($length) <= 120) { echo realistic_excerpt($length); } }
public function get_cat_posts($qty, $category, $date, $show_thumb, $show_excerpt, $excerpt_length) { // Custom CSS Output if ($show_thumb == 1) { $css = 'padding-left:80px;'; } else { $css = 'padding-left:10px;'; } global $post; $posts = new WP_Query("orderby=date&order=DESC&posts_per_page=" . ($qty - 1)); echo '<div class="widget-container recent-posts-wrap"><ul>'; while ($posts->have_posts()) { $posts->the_post(); ?> <?php echo '<li class="post-box horizontal-container" style="' . $css . '">'; ?> <?php if ($show_thumb == 1) { ?> <div class="widget-post-img"> <a rel="nofollow" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <img width="70" height="70" src="<?php echo realistic_get_thumbnail('tiny'); ?> " class="attachment-featured wp-post-image" alt="<?php the_title_attribute(); ?> "> <?php $format = get_post_format($post->ID); realistic_post_format_icon($format); ?> </a> </div> <?php } ?> <div class="widget-post-data"> <h4><a rel="nofollow" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h4> <?php if ($date == 1 || $category == 1) { ?> <div class="widget-post-info"> <?php if ($date == 1) { realistic_posted(); } ?> <?php if ($category == 1) { _e(' in ', 'realistic'); $thecategory = get_the_category(); echo '<span class="category"><a href="' . get_category_link($thecategory[0]->term_id) . '" title="' . sprintf(__("View all posts in %s", "realistic"), $thecategory[0]->name) . '" ' . '>' . $thecategory[0]->name . '</a></span>'; } ?> </div><!--end .widget-post-info--> <?php } ?> <?php if ($show_excerpt == 1) { ?> <div class="widget-post-excerpt"> <?php echo realistic_excerpt($excerpt_length); ?> </div> <?php } ?> </div> <?php echo '</li>'; ?> <?php } wp_reset_postdata(); echo '</ul></div>' . "\r\n"; }
public function get_popular_posts($qty, $category, $date, $days, $show_thumb, $show_excerpt, $excerpt_length) { // Custom CSS Output if ($show_thumb == 1) { $css = 'padding-left:80px;'; } else { $css = 'padding-left:10px;'; } global $post; $popular_days = array(); if ($days) { $popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true); } $popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days)); echo '<div class="widget-container recent-posts-wrap"><ul>'; foreach ($popular as $post) { setup_postdata($post); ?> <?php echo '<li class="post-box horizontal-container" style="' . $css . '">'; ?> <?php if ($show_thumb == 1) { ?> <div class="widget-post-img"> <a rel="nofollow" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <img width="70" height="70" src="<?php echo realistic_get_thumbnail('tiny'); ?> " class="attachment-featured wp-post-image" alt="<?php the_title_attribute(); ?> "> <?php $format = get_post_format($post->ID); realistic_post_format_icon($format); ?> </a> </div> <?php } ?> <div class="widget-post-data"> <h4><a rel="nofollow" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h4> <?php if ($date == 1 || $category == 1) { ?> <div class="widget-post-info"> <?php if ($date == 1) { realistic_posted(); } ?> <?php if ($category == 1) { _e(' in ', 'realistic'); $thecategory = get_the_category(); echo '<span class="category"><a href="' . get_category_link($thecategory[0]->term_id) . '" title="' . sprintf(__("View all posts in %s", "realistic"), $thecategory[0]->name) . '" ' . '>' . $thecategory[0]->name . '</a></span>'; } ?> </div> <!--end .post-info--> <?php } ?> <?php if ($show_excerpt == 1) { ?> <div class="widget-post-excerpt"> <?php echo realistic_excerpt($excerpt_length); ?> </div> <?php } ?> </div> <?php } wp_reset_postdata(); echo '</ul></div>' . "\r\n"; }