$custom = get_post_custom($post->ID); $cf_thumb = isset($custom["thumb"][0]) ? $custom["thumb"][0] : ""; if ($cf_thumb != "") { $cf_thumb = "<img src='" . $cf_thumb . "' alt='' width='290' height='90' />"; } ?> <?php if ($cf_thumb != "") { echo $cf_thumb; } else { the_post_thumbnail('blog-post-thumbnail', array('alt' => '', 'title' => '')); } ?> <?php $excerpt = get_the_excerpt(); echo ts_string_limit_words($excerpt, 20); ?> <a href="<?php the_permalink(); ?> " class="more" rel="bookmark" title="<?php _e('Permanent Link to', 'templatesquare'); ?> <?php the_title_attribute(); ?> "><?php _e('Read More', 'templatesquare'); ?> </a>
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $limit = apply_filters('widget_title', $instance['limit']); $cat = apply_filters('widget_title', $instance['cat']); $posttype = apply_filters('widget_posttype', $instance['posttype']); $effect = apply_filters('widget_effect', $instance['effect']); if ($effect == "fade") { $boxslideshow = "boxslideshow"; } else { $boxslideshow = "boxslideshow2"; } ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . '<a class="next"></a><a class="prev"></a>' . $after_title; } ?> <?php if ($posttype == "testimonial") { ?> <div class="<?php echo $boxslideshow; ?> "> <?php $limittext = $limit; ?> <?php global $more; $more = 0; ?> <?php query_posts("post_type=" . $posttype); ?> <?php while (have_posts()) { the_post(); ?> <?php $custom = get_post_custom($post->ID); $testiname = $custom["testimonial-name"][0]; $testicompany = $custom["testimonial-company"][0]; ?> <div class="cycle"> <?php if ($limittext == "" || $limittext == 0) { ?> <blockquote class="quote"> <div> <?php the_excerpt(); ?> </div></blockquote> <div class="name-testi"> <span class="user"><?php echo $testiname; ?> </span> <br style="line-height:4px" /><?php echo $testicompany; ?> </div> <?php } else { ?> <blockquote class="quote"> <div> <?php $excerpt = get_the_excerpt(); echo ts_string_limit_words($excerpt, $limittext) . '... '; ?> </div></blockquote> <div class="name-testi"> <span class="user"><?php echo $testiname; ?> </span> <br style="line-height:4px" /><?php echo $testicompany; ?> </div> <?php } ?> </div> <?php } ?> <?php wp_reset_query(); ?> </div> <!-- end of boxslideshow --> <?php } else { ?> <div class="<?php echo $boxslideshow; ?> "> <?php $limittext = $limit; ?> <?php global $more; $more = 0; ?> <?php if ($posttype == "display") { ?> <?php query_posts('&display-category=' . $cat . '&showposts=-1'); ?> <?php } else { ?> <?php query_posts("category_name=" . $cat); ?> <?php } ?> <?php while (have_posts()) { the_post(); ?> <?php $custom = get_post_custom($post->ID); $cf_thumb = $custom["thumb-cycle"][0]; if ($cf_thumb != "") { $cf_thumb = "<img src='" . $cf_thumb . "' alt='' width='269' height='120' />"; } ?> <div class="cycle"> <?php if ($cf_thumb != "") { echo $cf_thumb; } ?> <span class="wdt-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></span> <?php if ($limittext == "" || $limittext == 0) { the_excerpt(); } else { $excerpt = get_the_excerpt(); echo ts_string_limit_words($excerpt, $limittext) . '... '; ?> <?php } ?> </div> <?php } ?> <?php wp_reset_query(); ?> </div> <!-- end of boxslideshow --> <?php } ?> <?php echo $after_widget; ?> <?php }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $limit = $instance['limit'] != 0 ? absint($instance['limit']) : 4; $post_type = $instance['post_type']; $show_date = empty($instance['show_date']) ? 0 : $instance['show_date']; $show_avatar = empty($instance['show_avatar']) ? 0 : $instance['show_avatar']; $show_author = empty($instance['show_author']) ? 0 : $instance['show_author']; $show_comment = empty($instance['show_comment']) ? 0 : $instance['show_comment']; $is_slider = empty($instance['is_slider']) ? 0 : $instance['is_slider']; $row = $instance['row'] != 0 ? absint($instance['row']) : 2; $show_nav = empty($instance['show_nav']) ? 0 : $instance['show_nav']; $auto_play = empty($instance['auto_play']) ? 0 : $instance['auto_play']; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $args = array('number' => $limit, 'status' => 'approve', 'post_status' => 'publish', 'comment_type' => ''); if ($post_type != 'all') { $args['post_type'] = $post_type; } $comments = get_comments($args); if ($comments) { $count = 0; $num_posts = count($comments); if ($num_posts <= $row) { $is_slider = false; } if (!$is_slider) { $row = $num_posts; } $extra_class = ''; $extra_class .= $is_slider ? 'ts-slider loading' : ''; $extra_class .= $is_slider && $show_nav ? ' has-navi' : ''; ?> <div class="ts-recent-comments-widget-wrapper <?php echo esc_attr($extra_class); ?> " data-show_nav="<?php echo esc_attr($show_nav); ?> " data-auto_play="<?php echo esc_attr($auto_play); ?> "> <?php foreach ((array) $comments as $comment) { $GLOBALS['comment'] = $comment; ?> <?php if ($count % $row == 0) { ?> <div class="per-slide"> <ul class="comment_list_widget"> <?php } ?> <li> <div class="comment-meta"> <?php if ($show_avatar) { ?> <div class="avatar"> <a href="<?php comment_link(); ?> "><?php echo get_avatar($comment->comment_author_email); ?> </a> </div> <?php } ?> <div class="meta"> <?php if ($show_author) { ?> <span class="author"> <a href="<?php echo get_comment_author_url() == '' ? 'javascript: void(0)' : get_comment_author_url(); ?> " rel="external nofollow"><?php echo esc_html($comment->comment_author); ?> </a> </span> <?php } ?> <?php if ($show_date) { ?> <span class="date"> <?php comment_date('M d, Y'); ?> </span> <?php } ?> </div> </div> <?php if ($show_comment) { ?> <blockquote class="comment-body"><?php echo ts_string_limit_words(wp_strip_all_tags(get_comment_text()), 15); ?> </blockquote> <?php } ?> </li> <?php if ($count % $row == $row - 1 || $count == $num_posts - 1) { ?> </ul> </div> <?php } ?> <?php $count++; } ?> </div> <?php } echo $after_widget; }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('TS Recent Posts', 'templatesquare') : $instance['title']); $category = apply_filters('widget_category', $instance['category']); ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <?php if (have_posts()) { ?> <ul class="latestpost"> <?php $querycat = $category; ?> <?php query_posts("showposts=3&category_name=" . $querycat); global $post; ?> <?php while (have_posts()) { the_post(); ?> <?php $custom = get_post_custom($post->ID); $cf_thumb = ""; if (isset($custom["thumb"][0])) { $cf_thumb = $custom["thumb"][0]; if ($cf_thumb != "") { $cf_thumb = "<img src='" . $cf_thumb . "' alt='' width='80' height='80' class='alignleft'/>"; } } ?> <li> <?php if ($cf_thumb != "") { echo $cf_thumb; } ?> <span class="date"><?php the_time('M, d Y'); ?> </span> <?php $excerpt = get_the_excerpt(); echo ts_string_limit_words($excerpt, 15); ?> <a href="<?php the_permalink(); ?> " class="more" rel="bookmark" title="<?php _e('Permanent Link to', 'templatesquare'); ?> <?php the_title_attribute(); ?> "><?php _e('Read More...', 'templatesquare'); ?> </a> </li> <?php } ?> </ul> <?php } ?> <?php wp_reset_query(); ?> <?php echo $after_widget; ?> <?php }
<?php if ($cf_thumb != "") { echo "<img src='" . $cf_thumb . "' alt='' width='518' height='360' />"; } else { the_post_thumbnail('slider-home', array('alt' => '', 'title' => '')); } ?> <?php } ?> <div class="frame-slide-text"> <?php echo '<h1>' . get_the_title() . '</h1>'; $excerpt = get_the_excerpt(); echo ts_string_limit_words($excerpt, 50) . '... '; ?> <br/><br/> <div class="slider-button"> <?php if ($cf_slideurl != "") { ?> <a href="<?php echo $cf_slideurl; ?> "><?php echo $buttontext; ?> </a> <?php }
function ts_the_excerpt_max_words($word_limit = -1, $post = '', $strip_tags = true, $extra_str = '', $echo = true) { if ($post) { $excerpt = ts_get_the_excerpt_by_id($post->ID); } else { $excerpt = get_the_excerpt(); } if ($strip_tags) { $excerpt = wp_strip_all_tags($excerpt); $excerpt = strip_shortcodes($excerpt); } if ($word_limit != -1) { $result = ts_string_limit_words($excerpt, $word_limit); } else { $result = $excerpt; } $result .= $extra_str; if ($echo) { echo do_shortcode($result); } return $result; }