function create_excerpt($str='', $word_limit=15) { $str = trim(strip_tags($str)); $beg_count = strlen($str); $str = string_limit_words($str, $word_limit); $str = str_replace("\n", ' ', $str); $str = str_replace("\r", '', $str); $str = str_replace("\t", ' ', $str); if (strlen($str) < $beg_count) $str .= ' ...'; return $str; }
function the_excerpt_max_words($word_limit, $post = '', $echo = true) { if ($post) { $excerpt = wp_strip_all_tags(get_the_excerpt_here($post->ID)); } else { $excerpt = get_the_excerpt(); } $result = string_limit_words($excerpt, $word_limit); if ($echo) { echo $result; } return $result; }
public function product($id) { $data['storeCategory'] = $this->cart_model->get_categories(); $product = $this->product_model->getProduct($id); if (!empty($product['productData'])) { $data['product'] = $product; } else { redirect("store"); } $data['productAttribute'] = $this->product_model->getProductAttribute($id); $data['pageTitle'] = $data['product']['productData']->name; $data['pageDescription'] = string_limit_words($data['product']['productData']->description, 30); $data['productGallery'] = $this->product_model->getProductGallery($id); $this->load->view('productView', $data); }
function aione_list_comments_shortcode($atts) { // Attributes extract(shortcode_atts(array('count' => '', 'id' => '', 'class' => ''), $atts)); global $theme_options, $post; $output = ""; $number = $count; global $wpdb; $recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}"; $the_comments = $wpdb->get_results($recent_comments); if ($the_comments) { $output .= '<ul class="list-posts resent-comments">'; foreach ($the_comments as $comment) { $output .= '<li>'; $output .= '<div class="post-image">'; $output .= '<a>'; $output .= get_avatar($comment, '52'); $output .= '</a>'; $output .= '</div>'; $output .= '<div class="post-holder">'; $output .= strip_tags($comment->comment_author) . ' says:'; $output .= '<div class="post-meta">'; $output .= '<a class="comment-text-side" href="' . get_permalink($comment->ID) . '#comment-' . $comment->comment_ID . '" title="' . strip_tags($comment->comment_author) . ' on ' . $comment->post_title . '">'; $output .= string_limit_words(strip_tags($comment->com_excerpt), 12); $output .= '...</a>'; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="aione-clearfix"></div>'; $output .= '</li>'; } $output .= '</ul>'; } else { $output .= '<h5 class="font-size-16 aligncenter">No Comments Available.</h5>'; } return $output; }
$astpagecontent = 0; } } echo '<!-- astpagecontent=' . $astpagecontent . ' -->'; if ($reg_requirement == 1) { $showpagecontent = 0; } else { if ($astpagecontent === 0) { $showpagecontent = 0; } else { $showpagecontent = 1; } } } if ($showpagecontent == 0) { echo string_limit_words(get_the_excerpt(), 55) . '...</br>'; ?> <div style="border:#CCCCCC solid 1px; padding:10px;"> <form action="<?php echo get_option('home'); ?> /wp-login.php?wpe-login=esminc" method="post"> <p><strong>Free registration required to view this resource.</strong><br /> <br /> <a href="<?php echo get_option('home'); ?> /registration/?action=register&redirect_to=<?php echo urlencode(get_permalink()); if (defined($_GET['astc'])) {
?> "><?php the_title(); ?> </a></p> <div class="meta"> <?php the_author_posts_link(); ?> | <?php the_time(get_option('date_format')); ?> </div> <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt, 20); ?> </p> </div> <?php } ?> <?php get_template_part('bot-nav'); ?> </div> <!-- end sitemap-wide div --> </div> <!-- end entry div -->
comments_popup_link('0', '1', '%'); _e(" Comments", "Creativo"); ?> </li> <?php } ?> </ul> <?php } ?> <div class="post-content"> <?php if ($data['post_content'] != 'Full Content') { echo string_limit_words(get_the_excerpt(), $data['post_excerpt_length'] ? $data['post_excerpt_length'] : 30) . '...'; } else { the_content(); } ?> </div> <?php if ($data['show_view_more']) { ?> <div class="post-atts archive"> <?php if ($data['show_view_more']) { ?> <a href="<?php the_permalink();
} if ($status == '') { $status = 1; } if (empty($message)) { if (updatePage($id, $name, $content, $slug, $seotitle, $seodescrition, $seokeyword, $status, $mysqli) == true) { header("Location: ../page.php"); exit; } else { $message = '<div class="alert alert-danger">Invalid!</div>'; } } } else { $name = $_POST["name"]; $content = $_POST["content"]; $slug = string_limit_words($name); // First 6 words $seotitle = $_POST["seotitle"]; $seodescrition = $_POST["seodescrition"]; $seokeyword = $_POST["seokeyword"]; $status = $_POST["status"]; if (empty($name)) { $message .= 'Enter your page name<br>'; } if (empty($content)) { $message .= 'Enter your page content<br>'; } if ($status == '') { $status = 1; } if (empty($message)) {
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'page_id' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => '')); echo $before_widget; $featured_page = new WP_Query(array('page_id' => $instance['page_id'])); if ($featured_page->have_posts()) { while ($featured_page->have_posts()) { $featured_page->the_post(); ?> <?php if (!empty($instance['show_title'])) { ?> <?php echo $before_title . '<a href="' . get_permalink() . '">' . apply_filters('widget_title', get_the_title()) . '</a>' . $after_title; ?> <?php } elseif (!empty($instance['title'])) { ?> <?php echo $before_title . '<a href="' . get_permalink() . '">' . apply_filters('widget_title', $instance['title']) . '</a>' . $after_title; ?> <?php } ?> <div class="post clearfix"> <?php if (!empty($instance['show_image'])) { ?> <?php if ($instance['image_alignment'] == "") { $featimgsizefeatpage = 'featured-page'; } else { $featimgsizefeatpage = 'thumbnail'; } $solostream_img = get_the_image(array('meta_key' => 'thumbnail', 'size' => $featimgsizefeatpage, 'default_image' => false, 'format' => 'array', 'image_scan' => true, 'link_to_post' => false)); if ($solostream_img['url'] && get_option('solostream_show_thumbs') == 'yes' && get_post_meta($post->ID, 'remove_thumb', true) != 'Yes') { if ($instance['image_alignment'] == "") { ?> <a href="<?php the_permalink(); ?> " rel="<?php _e("bookmark", "solostream"); ?> " title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?> "><img class="thumbnail" src="<?php echo $solostream_img['url']; ?> " alt="<?php the_title(); ?> " title="<?php the_title(); ?> " /></a> <?php } else { ?> <a href="<?php the_permalink(); ?> " rel="<?php _e("bookmark", "solostream"); ?> " title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?> "><img class="thumbnail <?php echo $instance['image_alignment']; ?> " src="<?php echo $solostream_img['url']; ?> " alt="<?php the_title(); ?> " title="<?php the_title(); ?> " /></a> <?php } } ?> <?php } ?> <?php if (!empty($instance['show_content'])) { ?> <p> <?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt, $instance['content_limit']); ?> <?php if (!empty($instance['more_text'])) { ?> <a class="more-link" href="<?php the_permalink(); ?> " rel="<?php _e("bookmark", "solostream"); ?> " title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?> "><?php echo esc_html($instance['more_text']); ?> </a> <?php } ?> </p> <?php } ?> </div> <?php } } echo $after_widget; wp_reset_query(); }
/** * * Outputs the HTML code of this widget. * * @param array An array of standard parameters for widgets in this theme * @param array An array of settings for this widget instance * @return void * **/ function widget($args, $instance) { $cache = wp_cache_get('widget_dp_recent_post', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = null; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); // extract($args, EXTR_SKIP); // $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $post_cat = empty($instance['post_cat']) ? '' : $instance['post_cat']; $show_num = empty($instance['$show_num']) ? '' : $instance['$show_num']; $word_limit = empty($instance['$word_limit']) ? '' : $instance['$word_limit']; $thumb_width = empty($instance['$thumb_width']) ? '' : $instance['$thumb_width']; $show_thumb = empty($instance['$show_thumb']) ? 'true' : $instance['$show_thumb']; $show_title = empty($instance['$show_title']) ? 'true' : $instance['$show_title']; $show_date = empty($instance['$show_date']) ? 'true' : $instance['$show_date']; if ($thumb_width == "") { $thumb_width = '70'; } // echo $before_widget; echo $before_title; echo $title; echo $after_title; // $custom_posts = get_posts('showposts=' . $show_num . '&cat=' . get_cat_ID($post_cat)); if (!empty($custom_posts)) { echo "<div class='dp-recent-post-widget'>"; foreach ($custom_posts as $custom_post) { ?> <div class="recent-post-widget"> <?php $thumbnail_id = get_post_thumbnail_id($custom_post->ID); $thumbnail = wp_get_attachment_image_src($thumbnail_id); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (!empty($thumbnail) && $show_thumb == 'true') { ?> <div class="thumbnail"> <a href="<?php echo get_permalink($custom_post->ID); ?> "> <?php echo '<img width="' . $thumb_width . '" src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>'; ?> </a> </div> <?php } ?> <div class="content"> <?php if ($show_title == 'true') { ?> <h4><a href="<?php echo get_permalink($custom_post->ID); ?> "> <?php $excerpt = get_the_title($custom_post->ID); $excerpt = strip_shortcodes($excerpt); $word_limit = 5; echo string_limit_words($excerpt, $word_limit); ?> …</a></h4> <?php } ?> <?php /* if ($word_limit > 0) { ?> <div class="excerpt"><a href="<?php echo get_permalink( $custom_post->ID ); ?>"> <?php $excerpt = get_post_field('post_content', $custom_post->ID); $excerpt = strip_shortcodes( $excerpt ); ; echo string_limit_words($excerpt,$word_limit);?>…</a></div> <?php } */ ?> <?php if ($show_date == 'true') { ?> <div class="date"> <?php echo mysql2date('j.m. Y', $custom_post->post_date); ?> </div> <?php } ?> </div> <div class="clearboth"></div> </div> <?php } echo "</div>"; } // echo $after_widget; // save the cache results $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_dp_recent_post', $cache, 'widget'); }
function widget($args, $instance) { extract($args, EXTR_SKIP); include_once ABSPATH . WPINC . '/rss.php'; // setlocale(LC_TIME, "danish", "da_DK", "da_DK.iso-8859-1", "da_DK.utf-8"); // Widget instance variables $feed_url = $instance['feed_url']; $feed = fetch_rss($feed_url); $title = empty($instance['title']) ? __('RSS news', 'flexible_rss_widget') : apply_filters('widget_title', $instance['title']); $checkExcerpt = $instance['checkExcerpt']; $checkAuthor = $instance['checkAuthor']; $checkDate = $instance['checkDate']; $checkCats = $instance['checkCats']; $checkPages = $instance['checkPages']; $selectCat = (int) $instance['selectCat']; if (!($number = (int) $instance['number'])) { $number = 4; } else { if ($number < 1) { $number = 1; } } $items = array_slice($feed->items, 0, $number); if ($checkCats != 0 && is_category($checkCats) || $checkCats != 0 && is_single() && in_category($checkCats) || $checkPages != 0 && is_page($checkPages) || $checkCats == 0 && $checkPages == 0 && (is_single() || is_singular('anbefalinger') || is_category() || is_tax('materialetyper') || is_page())) { echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="rss-widget"> <ul> <?php if (empty($items)) { echo '<li>' . _e('There are no posts in this feed') . '</li>'; } else { foreach ($items as $item) { ?> <li> <h3><a class="title" href='<?php echo $item['link']; ?> '><?php if (empty($item['title'])) { __('Untitled'); } else { echo $item['title']; } ?> </a></h3> <?php if ($checkDate == 'date') { echo '<span class="rss-date">' . strftime('%e. %b %Y', strtotime($item['pubdate'])) . '</span> '; } if ($checkAuthor == 'author') { ?> <span class="meta-prep meta-prep-author"><?php _e('Af '); ?> </span><?php echo '<cite>' . $item['dc']['creator'] . '</cite>'; } if ($checkExcerpt == 'excerpt') { echo '<div class="rssSummary">' . string_limit_words($item['description'], 20) . '</div>'; // Set # of words to display in excerpt. } ?> </li> <?php } } ?> <li><a class="widget-rss-link" href="<?php echo $feed_url; ?> "><?php echo __('RSS feed'); ?> </a></li> </ul> </div> <?php echo $after_widget; } // end if }
<br/> <br/> <?php $pops1 = get_popular_posts_by_category($pages, 13, 4); foreach ($pops1 as $pop) { echo $pop->post->post_title; $post_content = $pop->post->post_content; } if (strlen($post_content) <= 140) { echo $post_content; } else { for ($i = 2; strlen(string_limit_words($post_content, $i)) <= 140; $i++) { } $i--; echo string_limit_words($post_content, $i) . "..."; } ?> <?php php; ?> <pre><?php //var_dump($pops2); ?> </pre> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries'); ?> </div>
?> blog-thumbnail-placeholder.jpg"></a> <?php } ?> <div class="blog-content"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <p><?php echo string_limit_words(get_the_content(), 28) . "..."; ?> </p> <a href="<?php the_permalink(); ?> ">Read More >></a> </div><!-- END blog-content --> </div><!-- END blog-post --> <?php } } else { ?> <p>There are no posts or pages here</p>
function setesm_postdisplay_m($postid = 0, $ast = 0, $astc = 0) { global $page; $noreg = get_post_meta($postid, 'No Registration', $single = true); if ($noreg != null) { $bypassreg = 1; } if (isset($_COOKIE['esmpass'])) { $bypassreg = 1; } /* Check if the user is on page gt 1 and not logged in */ global $page; if ($bypassreg == 1 or is_user_logged_in()) { $showpagecontent = 1; } else { if (in_category(array(139, 127)) and !$bypassreg == 1 or in_category(array(139, 127)) and !is_user_logged_in()) { $showpagecontent = 0; } else { if (in_category(array(163, 166, 167)) and $page > 1) { $showpagecontent = 0; } else { if ($astused > 1) { $showpagecontent = 0; } else { //let them in $showpagecontent = 1; } } } } ?> <div id="title"> <h2><?php if (in_category(array(19, 20, 21))) { echo 'Press Release: '; } the_title(); ?> </h2> </div> <div class="postmeta"> <?php $SubTitle = get_post_meta($postid, 'Sub Title', $single = true); if ($SubTitle != null) { echo '<span class="subtitle">' . $SubTitle . '</span></br>'; the_time('F jS, Y'); echo '</br>'; } ?> <?php if (function_exists('gkl_postavatar')) { echo '<div style="float:left; margin-right:5px;">'; gkl_postavatar(postavatar); echo '</div>'; } ?> <?php $PageByLine = get_post_meta($postid, 'Byline', $single = true); if ($PageByLine != null) { echo $PageByLine . '<br/>'; } else { echo '<span class="byline">'; } if (in_category(29)) { echo '<a href="' . get_category_link(29) . '">' . 'Read more news from Around the Web </a></span>'; } elseif (in_category(126)) { echo '<a href="' . get_category_link(126) . '">' . 'View more Sites of the Week </a></span>'; } elseif (in_category(19)) { echo '<a href="' . get_category_link(19) . '">' . 'View more Press Releases </a></span>'; } elseif (in_category(20)) { echo '<a href="' . get_category_link(20) . '">' . 'View more Partner Press Releases</a></span>'; } elseif (in_category(21)) { echo '<a href="' . get_category_link(21) . '">' . 'View more Press Releases from Technology Providers</a></span>'; } else { ?> Read more by <?php $AltAuthorName = get_post_meta($postid, 'Alt Author Read More Name', $single = true); $AltAuthorLink = get_post_meta($postid, 'Alt Author Read More Link', $single = true); $AltDate = get_post_meta($postid, 'Alt Date', $single = true); if ($AltAuthorName != null) { if ($AltAuthorName == 'hide' or $AltAuthorName == '0') { //delete the line } else { if ($AltAuthorLink != null) { echo '<a href="' . $AuthorLink . '" title="' . $AltAuthorName . '" rel="author">' . $AltAuthorName . '</a>'; } else { echo $AltAuthorName; } } } else { the_author_posts_link(); } } ?> </div> <div class="post"> <?php if ($astc > 1) { ?> <div id="title"> <h2>Table of Contents</h2> </div> <?php echo '<div class="toc"><h3>' . get_cat_name($astc) . '</h3>'; $e = 1; $query5 = new WP_Query(); $query5->query('posts_per_page=-1&cat=' . $astc); while ($query5->have_posts()) { $query5->the_post(); ?> <p><a href="<?php the_permalink(); echo '?ast=' . $ast . '&astc=' . $astc; ?> " rel="bookmark"><?php the_title(); ?> </a></p> <?php $e++; } wp_reset_query(); ?> </div> <?php } ?> <?php if (has_post_thumbnail()) { $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); ?> <a href="<?php the_permalink(); ?> " class="thumbnail"><img src="<?php echo mopr_create_thumbnail($thumbnail_url[0], 0, 50, 50); ?> " /></a> <?php } ?> <?php if ($showpagecontent == 1) { the_content(); $ContactName = get_post_meta($postid, 'Contact Name', $single = true); $ContactEmail = get_post_meta($postid, 'Contact Email', $single = true); $ContactPhone = get_post_meta($postid, 'Contact Phone', $single = true); $ContactURL = get_post_meta($postid, 'Contact URL', $single = true); if ($ContactURL != null) { if (!preg_match("#^http://www\\.[a-z0-9-_.]+\\.[a-z]{2,4}\$#i", $ContactURL)) { $ContactURL = 'http://' . $ContactURL; } } $GrantOrg = get_post_meta($postid, 'Grant Org', $single = true); if ($ContactName != null || $ContactEmail != null || $ContactPhone != null || $ContactURL != null || $GrantOrg != null) { ?> <blockquote> <strong>Contact Information</strong><hr /> <ul> <?php $Eligibility = get_post_meta($postid, 'Eligibility', $single = true); $GrantDeadline = get_post_meta($postid, 'Grant Deadline', $single = true); $GrantHeadline = get_post_meta($postid, 'Grant Headline', $single = true); $GrantValue = get_post_meta($postid, 'Grant Value', $single = true); if ($GrantOrg != null) { echo '<li><strong>Grant Organization: </strong>' . $GrantOrg . '</li>'; } if ($ContactName != null) { echo '<li><strong>Contact Name: </strong>' . $ContactName . '</li>'; } if ($ContactPhone != null) { echo '<li><strong>Contact Phone: </strong>' . $ContactPhone . '</li>'; } if ($ContactEmail != null) { echo '<li><strong>Contact Email: </strong>' . $ContactEmail . '</li>'; } if ($ContactURL != null) { echo '<li><strong>Contact URL: </strong><a href="' . $ContactURL . '" target="_blank" alt="Grant Link">' . substr($ContactURL, 0, 30) . '</a>...</li>'; } if ($Eligibility != null) { echo '<li><strong>Eligibility: </strong>' . $Eligibility . '</li>'; } if ($GrantDeadline != null) { $grantdatetime = date_create($GrantDeadline); echo '<li><strong>Grant Deadline: </strong>' . $grantdatetime->format('l F jS, Y') . '</li>'; } if ($GrantValue != null) { echo '<li><strong>Grant Value: </strong>' . $GrantValue . '</li>'; } echo '</ul></blockquote>'; } // make sure any advanceded content gets cleared echo '<div class="clear"></div>'; // Display pagination echo '<div align="left" style="border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; width:100%; float:left; font-size:20px; font-weight:bold; line-height:30px;">'; if ($ast > 1) { enhanced_link_pages(array('blink' => '', 'alink' => ' ', 'before' => '<strong>Pages:</strong> ', 'after' => '', 'next_or_number' => 'next', 'afterhref' => 'ast=' . $ast . '&astc=' . $astc)); } else { enhanced_link_pages(array('blink' => '', 'alink' => ' ', 'before' => '<div class="pagelinks">Pages: ', 'after' => '</div>', 'next_or_number' => 'next')); } echo '</div>'; // Post Widget gab_dynamic_sidebar('PostWidget'); ?> <div style="clear:both;"></div> <div style="clear:both"></div> <?php } else { ?> <p><?php print string_limit_words(get_the_excerpt(), 35); ?> ...</p> <div style="border:#CCCCCC solid 1px; padding:10px;"> <form action="<?php echo get_option('home'); ?> /wp-login.php" method="post"> <table style="width:100%;"> <tr><td colspan="2"><p><strong>Free registration required to continue reading this article.</strong></p></td></tr> <tr><td style="width:45%; padding-right:10px; border-right:1px solid #666"> Register today and receive free access to all our news and resources and the ability to customize your news by topic with My eSchool News.<br /><br /> <a href="<?php echo get_option('home'); ?> /wp-login.php?action=register&redirect_to=?redirect_to=<?php echo urlencode(get_permalink()); ?> " style="text-decoration:underline;"><strong>Register now.</strong></a> </td> <td style="width:55%; padding-left:10px"> Already a member? Log in <div>Username: <input type="text" name="log" id="log" value="" /></div> <div>Password:  <input name="pwd" id="pwd" type="password" value="" /></div> <input type="submit" name="submit" value="Login" class="button"> <input name="rememberme" id="rememberme" type="hidden" checked="checked" value="forever"> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?> "> <br /> <a href="<?php echo get_option('home'); ?> /wp-login.php?action=lostpassword" target="_blank">Lost Password?</a> </td></tr></table> </form> </div> <?php } //end showpagecontent check ?> </div> </div> <?php }
function widget($args, $instance) { extract($args); $posts = $instance['posts']; $comments = $instance['comments']; $images = true; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <!-- BEGIN WIDGET --> <div class="tabs-wrapper"> <ul class="tabs"> <li><a href="#tab1"><?php _e('Popular', "mm"); ?> </a></li> <li><a href="#tab2"><?php _e('Comments', "mm"); ?> </a></li> <li><a href="#tab3"><?php _e('Tags', "mm"); ?> </a></li> </ul> <div class="tabs_container"> <div id="tab1" class="tab_content"> <?php $popular_posts = new WP_Query('showposts=' . $posts . '&orderby=comment_count&order=DESC'); if ($popular_posts->have_posts()) { ?> <?php while ($popular_posts->have_posts()) { $popular_posts->the_post(); ?> <?php if (has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) { $icon = '<span class="' . get_post_format($post->ID) . '-icon"></span>'; } else { $icon = ''; } ?> <div class="block-item-small-tabs"> <div class="block-image"><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail('sidebar-thumb'); ?> </a></div> <div class="block-image-r"> <h2><a href='<?php the_permalink(); ?> ' title='<?php the_title(); ?> '><?php the_title(); ?> </a></h2> </div> </div> <?php } ?> <?php } ?> </div> <div id="tab2" class="tab_content"> <?php $number = $instance['comments']; global $wpdb; $recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}"; $the_comments = $wpdb->get_results($recent_comments); foreach ($the_comments as $comment) { ?> <div class="block-item-small-tabs"> <div class="block-image"> <?php echo get_avatar($comment, '50'); ?> </div> <div class="block-image-r"> <h2><?php echo strip_tags($comment->comment_author); ?> says:</h2> <a class="comment-text-side" href="<?php echo get_permalink($comment->ID); ?> #comment-<?php echo $comment->comment_ID; ?> " title="<?php echo strip_tags($comment->comment_author); ?> on <?php echo $comment->post_title; ?> "><?php echo string_limit_words(strip_tags($comment->com_excerpt), 12); ?> ...</a> </div> </div> <?php } ?> </div> <div id="tab3" class="tab_content"> <p class='tag_cloud'> <?php wp_tag_cloud(); ?> </p> </div> </div> </div> <!-- END WIDGET --> <?php echo $after_widget; }
/* * Posts inside the current Item * For each item it generates the posts HTML */ $events = $chunk; foreach ($events as $post) { setup_postdata($post); $html .= '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 home-page-carousel-item mobile-stacked">'; if (has_post_thumbnail($post->ID)) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); $html .= '<div class="col-md-12 home-page-carousel-item-inner-top" style="background-image: url(' . $image[0] . '); background-position: 0% 50%;"></div>'; } $html .= '<div class="col-md-12 home-page-carousel-item-inner-bottom" style="min-height: 110px;">'; $html .= '<strong>' . get_the_title() . '</strong><br>'; $blurb = get_the_excerpt(); $html .= string_limit_words($blurb, 8); $html .= '</div>'; $html .= '<a href="' . get_permalink() . '"><span class="carousel-item-link"></span></a>'; $html .= '</div>'; } wp_reset_postdata(); $html .= '</div>'; } // Prints the HTML echo $html; } ?> </div> </div> <!-- carousel inner --> <!-- Controls --> <a class="left carousel-control" href="#promo-carousel2-m" role="button" data-slide="prev">
$slug = $category->slug; $name = $category->name; echo "<li class=\"filter btn btn-outline-white btn-small\" data-filter=\"" . $slug . "\">" . $name . "</li>"; } ?> </ul> <ul id="portfolio-grid" class="row portfolio-row"> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $title = str_ireplace('"', '', trim(get_the_title())); $desc = string_limit_words(get_the_content(), 25); $terms = get_the_terms($post->ID, 'portfoliocats'); $permalink = get_permalink($id); if ($terms && !is_wp_error($terms)) { $portfolio_links = array(); $parent = array(); foreach ($terms as $term) { $portfolio_links[] = $term->slug; $parent[] = $term->parent; } $slug = join(" ", $portfolio_links); $parent_slug = get_term_by('id', $parent[0], 'portfoliocats'); $final_parent = $parent_slug->slug; $slug .= " " . $final_parent; } ?>
echo '<div class="category_title"><a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . '>' . $category->name . '</a> </div> '; echo '<ul class="post_list">'; $cat = $category->term_id; $myPosts = new WP_Query(); $myPosts->query('cat=' . $cat . '&showposts=5'); while ($myPosts->have_posts()) { $myPosts->the_post(); echo '<li><a href="' . get_permalink() . '">'; if (strlen(get_the_title()) <= 50) { the_title(); } else { $i = 11; $title = string_limit_words(get_the_title(), $i); while (strlen($title) > 50) { $i--; $title = string_limit_words($title, $i); } echo $title . "..."; } echo '</a></li>'; } echo '</ul>'; echo '</div>'; } } ?> </div><!--/justin_page--> <div class="home-blockofwin-300x250"> </div> </div><!--/justin_content-->
function widget($args, $instance) { extract($args); global $wpdb; // call global for use in function $title_recent = empty($instance['title_recent']) ? __('Latest News', 'wpdance') : $instance['title_recent']; $title_comment = empty($instance['title_comment']) ? __('Comments', 'wpdance') : $instance['title_comment']; $num_recent = empty($instance['num_recent']) ? 5 : absint($instance['num_recent']); $num_comment = empty($instance['num_comment']) ? 5 : absint($instance['num_comment']); $thumbnail_width = 60; $thumbnail_height = 60; $_thumb_size = array(60, 60); echo $before_widget; wp_reset_query(); //add_image_size('tabs-post-thumbnail',$thumbnail_width,$thumbnail_height,true); ?> <div class="container-tabs"> <div id="tabs-post-sidebar" class="tabs-post-sidebar"> <ul class="nav nav-tabs wd-widget-multitabs"> <li class="first"><a href="#recent-tab"><span><span><?php echo esc_attr($title_recent); ?> </span></span></a></li> <li class="last"><a href="#comment-tab"><span><span><?php echo esc_attr($title_comment); ?> </span></span></a></li> </ul> <!-- Recent Tab --> <div class="tab-content"> <?php $r = new WP_Query(array('posts_per_page' => $num_recent, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)); ?> <div id="recent-tab" class="tab-post-content tab-pane"> <div class='top-left'><div class='top-right'></div></div> <?php if ($r->have_posts()) { $i = 0; ?> <div class="contentcenter"> <ul class="recent-post-list tabs-post-list"> <?php while ($r->have_posts()) { global $post; $r->the_post(); ?> <li <?php if ($i == 0) { echo "class='first'"; } else { if ($i == $r->post_count - 1) { echo "class='last'"; } } ?> > <div class="image"> <a class="thumbnail" href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail('prod_tini_thumb', array('title' => esc_attr(get_the_title()), 'alt' => esc_attr(get_the_title()))); } ?> </a> <span class="shadow"></span> </div> <div class="content"> <p class="title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></p> <span class="wpt-author-time"> <span class="author"><i class="icon-user custom-icon"></i><?php the_author(); ?> </span> <span class="time"><i class="icon-calendar custom-icon"></i><?php the_time(get_option('date_format')); ?> </span> <span class="comment-number"><i class="icon-comments-alt custom-icon"></i><?php comments_number('0 Comments', '1 Comment', '% Comments'); ?> </span> </span> </div> </li> <?php $i++; } ?> </ul> </div> <?php } ?> <?php wp_reset_query(); ?> <div class='bot-left'><div class='bot-right'></div></div> </div><!-- End #recent-tab --> <!-- Comment Tab --> <?php $recent_comments = get_comments(array('number' => $num_comment, 'status' => 'approve')); ?> <div id="comment-tab" class="tab-post-content tab-pane"> <div class='top-left'><div class='top-right'></div></div> <?php if (count($recent_comments)) { $i = 0; ?> <div class="contentcenter"> <ul class="tabs-comments-list"> <?php foreach ($recent_comments as $comment) { $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { case '': $class = ""; if ($i == 0) { $class .= "first "; } if (++$i == count($recent_comments)) { $class .= "last"; } ?> <li <?php if ($class) { echo "class='{$class}'"; } ?> > <div class="avarta"><a href="<?php comment_link(); ?> "><?php echo get_avatar($comment, 58, get_bloginfo('template_url') . '/images/mycustomgravatar.png'); ?> </a></div> <div class="detail"> <div class="comment-author vcard"> <?php printf(__('%s', 'wpdance'), sprintf('<cite class="fn"><a href="%1$s" rel="external nofollow" class="url">%2$s</a></cite>', get_comment_author_url(), get_comment_author())); ?> : </div><!-- .comment-author .vcard --> <blockquote class="comment-body"><?php echo string_limit_words(get_comment_text(), 10); ?> </blockquote> <div class="comment-meta"><span><?php _e("in", "wpdance"); ?> <a href="<?php echo esc_url(get_permalink($comment->comment_post_ID)); ?> "><?php echo esc_attr(get_the_title($comment->comment_post_ID)); ?> </a></span></div> </div> </li> <?php break; case 'pingback': case 'trackback': break; } ?> <?php } ?> </ul> </div> <?php } ?> <?php wp_reset_query(); ?> <div class='bot-left'><div class='bot-right'></div></div> </div><!-- End #comment-multi-tab --> </div> </div> </div> <?php $rand_id = rand(); $random_id = "accordion-" . $rand_id; ?> <div class="accordion-tabs wd-widget-multitabs-accordion" id="<?php echo $random_id; ?> " style="display:none;"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" href="#collapseTwo-<?php echo $rand_id; ?> " data-parent="#<?php echo $random_id; ?> " data-toggle="collapse"><span><span><?php echo esc_attr($title_recent); ?> </span></span></a> </div> <div class="accordion-body collapse" id="collapseTwo-<?php echo $rand_id; ?> "> <div class="accordion-inner"> </div> </div> </div> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" href="#collapseThree-<?php echo $rand_id; ?> " data-parent="#<?php echo $random_id; ?> " data-toggle="collapse"><span><span><?php echo esc_attr($title_comment); ?> </span></span></a> </div> <div class="accordion-body collapse" id="collapseThree-<?php echo $rand_id; ?> "> <div class="accordion-inner"> </div> </div> </div> </div> <script type="text/javascript"> //<![CDATA[ jQuery(function() { var windowWidth = jQuery(window).width(); jQuery( ".tabs-post-sidebar" ).tabs({ fx: { opacity: 'toggle', duration:'slow'} }).addClass( "ui-tabs-vertical ui-helper-clearfix" ); jQuery(window).resize(function() { windowWidth = jQuery(window).width(); if( jQuery.browser.msie && parseInt( jQuery.browser.version, 10 ) == 7 ){ jQuery.debounce(1000, function() { if(windowWidth >=200 && windowWidth <= 768){ jQuery(".widget_multitab > .accordion-tabs").each(function(index,value){ recentHtml = jQuery(value).siblings('.container-tabs').find('#recent-tab').html(); cmtHtml = jQuery(value).siblings('.container-tabs').find('#comment-tab').html(); jQuery(value).find('#collapseTwo-<?php echo $rand_id; ?> ').children().html(recentHtml); jQuery(value).find('#collapseThree-<?php echo $rand_id; ?> ').children().html(cmtHtml); jQuery(value).siblings('.container-tabs').hide(); jQuery(value).show().collapse({ toggle : false }); }); }else if( windowWidth >= 768 ){ jQuery(".widget_multitab > .accordion-tabs").each(function(index,value){ jQuery(value).hide().siblings('.container-tabs').show(); }); } }); }else{ if(windowWidth >=200 && windowWidth <= 768){ jQuery(".widget_multitab > .accordion-tabs").each(function(index,value){ recentHtml = jQuery(value).siblings('.container-tabs').find('#recent-tab').html(); cmtHtml = jQuery(value).siblings('.container-tabs').find('#comment-tab').html(); jQuery(value).find('#collapseTwo-<?php echo $rand_id; ?> ').children().html(recentHtml); jQuery(value).find('#collapseThree-<?php echo $rand_id; ?> ').children().html(cmtHtml); jQuery(value).siblings('.container-tabs').hide(); jQuery(value).show().collapse({ toggle : false }); }); }else if( windowWidth >= 768 ){ jQuery(".widget_multitab > .accordion-tabs").each(function(index,value){ jQuery(value).hide().siblings('.container-tabs').show(); //jQuery("#right-sidebar").css("height","auto"); }); } } }); if(windowWidth >=200 && windowWidth <= 768){ jQuery(".widget_multitab > .accordion-tabs").each(function(index,value){ recentHtml = jQuery(value).siblings('.container-tabs').find('#recent-tab').html(); cmtHtml = jQuery(value).siblings('.container-tabs').find('#comment-tab').html(); jQuery(value).find('#collapseTwo-<?php echo $rand_id; ?> ').children().html(recentHtml); jQuery(value).find('#collapseThree-<?php echo $rand_id; ?> ').children().html(cmtHtml); jQuery(value).siblings('.container-tabs').hide(); jQuery(value).show().collapse({ toggle : false }); }); } }); //]]> </script> <?php echo $after_widget; }
function populer_posts() { ?> <ul><li id="recent-posts"> <h2>Populer posts</h2> <ul style="list-style:none;"> <?php global $post; $postslist = get_posts('numberposts=3&orderby=comment_count'); foreach ($postslist as $post) { setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail(array(60, 60), array("class" => "alignleft popular-sidebar")); ?> </a> <span style="padding-top:0px;float:left; width:200px;"><a style="float:left; font-weight:bold; width:200px; padding-top:5px;" title="Post: <?php the_title(); ?> " href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><br/> <?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt, 8); echo " [...]"; //comments_number('0 comments', 'One Comments', '% Comments' ); ?> </span> <div class="clear"></div> </li> <?php } ?> </ul> </li> <?php }
?> <i class="fa fa-angle-double-right"></i> </a> </div> <?php } ?> <h2 class="entry-title"> <a style="color: rgb(<?php echo $rgb; ?> );" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'gabfire'), the_title_attribute('echo=0')); ?> " > <?php the_title(); ?> </a> </h2> <?php echo '<p>' . string_limit_words(12) . '</p>'; ?> </article>
?> </span></span> </div> <div class="padding-15"> <span class="cat"><?php the_category(); ?> </span> <h4><?php the_title(); ?> </h4> <p> <?php $excerpt = get_the_excerpt(); echo '<p>' . string_limit_words($excerpt, 20) . '...</p>'; ?> </p> <a class="vermas" href="<?php the_permalink(); ?> ">VER MÁS</a> </div> </div> </div> <?php } ?> <?php } ?>
function widget($args, $instance) { global $comments, $comment; $cache = wp_cache_get('widget_recent_comments', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } extract($args, EXTR_SKIP); $output = ''; $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments', 'wpdance') : $instance['title'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 5; } $count = 0; $comments = get_comments(array('number' => $number, 'status' => 'approve', 'post_type' => 'post', 'post_status' => 'publish')); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo '<div id="recentcomments">'; if ($comments) { foreach ((array) $comments as $comment) { $count++; ?> <div class="recentcomments_custom <?php if ($count == 1) { echo " first"; } if ($count == count($comments)) { echo " last"; } ?> "> <div class="detail123"> <?php $comment_count = wp_count_comments($comment->comment_post_ID)->total_comments; if ($comment_count < 10) { $comment_count = '0' . $comment_count; } ?> <span class="recent_comments_count"><?php echo esc_html($comment_count); ?> <span class="comment_count_detail"></span></span> <span class="comment-meta"><?php _e("comment by", "wpdance"); ?> <a href="<?php echo esc_url($comment->comment_author_url); ?> "><?php echo esc_html($comment->comment_author); ?> </a> </span> <h3 class="post_title"><a title="<?php echo esc_attr($comment->post_title); ?> " href="<?php echo get_permalink($comment->comment_post_ID); ?> "><?php echo esc_html($comment->post_title); ?> </a></h3> <blockquote class="comment-body"><?php echo string_limit_words(get_comment_text(), 10); ?> </blockquote> </div> </div> <?php } } echo '</div>'; $output .= $after_widget; echo $output; $cache[$args['widget_id']] = $output; wp_cache_set('widget_recent_comments', $cache, 'widget'); }
?> <h2 class="entry-title s_posttitle"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php printf(esc_attr__('Permalink to %s', 'gabfire'), the_title_attribute('echo=0')); ?> " ><?php the_title(); ?> </a> </h2> <p><?php echo string_limit_words(18); ?> </p> <p class="postmeta"> <?php gabfire_bydate(); gabfire_commentsnr(); ?> </p> </article> <?php } ?> <?php
the_tags('<span class="hidden-xs"><i class="fa fa-tags"></i>', ', ', ' </span>'); ?> <span class="hidden-md hidden-sm"><i class="fa fa-folder-o"></i><?php the_category(', '); ?> </span> <?php edit_post_link('Edit', '<span><i class="fa fa-pencil-square-o"></i>', '</span>'); ?> </p> <?php gabfire_media(array('name' => 'post-sidebar', 'imgtag' => 1, 'link' => 1, 'enable_video' => 1, 'video_id' => 'postfull', 'enable_thumb' => 1, 'resize_type' => 'c', 'media_width' => 700, 'media_height' => 380, 'thumb_align' => 'aligncenter', 'enable_default' => 0)); ?> <p><?php echo string_limit_words(get_the_excerpt(), 30); ?> …</p> </article> <?php if ($count % 3 == 0) { echo '<div class="clearfix"></div>'; } ?> <?php $count++; } } else { }
function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } // WIDGET CODE GOES HERE ?> <?php /*function string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); return implode(' ', $words); }*/ ?> <!-- latest-news --> <div class="new-contents dark-bg"> <h2>Latest News</h2> <?php global $post; $postslist = get_posts('category_name=news&numberposts=3&orderby=post_date'); /*if(is_page(80)){ $postslist=get_posts('category_name=opm&numberposts=3&orderby=post_date'); }*/ if ($postslist) { foreach ($postslist as $post) { setup_postdata($post); ?> <div class="new-column"> <a href="<?php the_permalink(); ?> "> <div class="img-holder"><?php the_post_thumbnail(array(60, 60)); ?> </div> <h3><?php the_title(); ?> </h3> <h4><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt, 8); //comments_number('0 comments', 'One Comments', '% Comments' ); ?> </h4> <span class="more-about">more...</span> </a> </div><?php } ?> <div class="all-news"><a href="index.php?page_id=78" class="more-btn"></a></div> <?php } else { ?> <h4 style="padding:0 0 0 15px; color:#fff;">No posts available.</h4> <?php } ?> </div> <?php echo $after_widget; }
?> <div class="item-description alt"> <h5><a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('Permalink to %s', 'purepress'), the_title_attribute('echo=0')); ?> " rel="bookmark"> <?php the_title(); ?> </a></h5> <?php $excerpt = get_the_excerpt(); $short_excerpt = string_limit_words($excerpt, 11); if (ot_get_option('centum_portfolio_text') == 'excerpt') { echo '<p>' . $excerpt . '</p>'; } else { echo '<p>' . $short_excerpt . '</p>'; } ?> </div> </div> <!-- Post --> <?php } // End the loop. Whew. ?> </div> <div class="pagination">
$parent_name = $fetch_child_id['name']; $insert1 = "INSERT INTO postcode_location(user_id,main_cat_id,sub_cat_id,sub_sub_cat,sub_cat_child_child,sub_cat_child_child_child,postcode,companyname,house_name,town,map,date,item_price)VALUES('" . $user_id . "','" . $main_cat . "','" . $sub_cat_id . "','" . $sub_sub_cat . "','" . $sub_cat_child_child_child . "','" . $sub_cat_child_child_child . "','" . $postcode . "','" . $companyname . "','" . $house_name . "','" . $town . "','" . $mape . "','" . $cdate . "','" . $price . "')"; $run_insert1 = mysql_query($insert1); $query = "SELECT MAX(id) FROM postcode_location"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $max_id = $row['MAX(id)']; function string_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } $utitle = mysql_real_escape_string($title); $utitle = htmlentities($utitle); $date = date("Y/m/d"); $newtitle = string_limit_words($utitle, 6); $urltitle = preg_replace('/[^a-z0-9]/i', ' ', $newtitle); $newurltitle = str_replace(" ", "-", $newtitle); $url = $newurltitle; $insert2 = "INSERT INTO ad_title_description(postcode_loaction_id,title,description,url)VALUES('" . $max_id . "','" . $title . "','" . $description . "','" . $url . "')"; $run_insert2 = mysql_query($insert2); if (!empty($link_website)) { $insert3 = "INSERT INTO your_web_link(postcode_loaction_id,link_site,price)VALUES('" . $max_id . "','" . $link_site . "','" . $link_website_price . "')"; $run_insert3 = mysql_query($insert3); } if (!empty($youtube_link)) { $insert_youtube = "INSERT INTO youtube_link(postcode_loaction_id,youtube_link)VALUES('" . $max_id . "','" . $youtube_link . "')"; $run_youtube = mysql_query($insert_youtube); } if (!empty($selectall)) { $num = sizeof($selectall);
</div> <div class="caption"> <h3><?php the_title(); ?> </h3> <div class="fecha"><?php the_time('j'); ?> <span class='mes'><?php the_time('M'); ?> </span></div> <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt, 35); ?> … <span class="vermas">[seguir leyendo]</span></p> </div> </a> </div> </div> <?php } ?> </div> <p class="aligncenter"> <a class="btn btn-primary btn-center" href="<?php
function widget($args, $instance) { global $data, $post; extract($args); $posts = $instance['posts']; $comments = $instance['comments']; $tags_count = $instance['tags']; $show_popular_posts = isset($instance['show_popular_posts']) ? 'true' : 'false'; $show_recent_posts = isset($instance['show_recent_posts']) ? 'true' : 'false'; $show_comments = isset($instance['show_comments']) ? 'true' : 'false'; $show_tags = isset($instance['show_tags']) ? 'true' : 'false'; $orderby = $instance['orderby']; if (!$orderby) { $orderby = 'Highest Comments'; } echo $before_widget; ?> <div class="tab-holder"> <div class="tab-hold tabs-wrapper"> <ul id="tabs" class="tabset tabs"> <?php if ($show_popular_posts == 'true') { ?> <li><a href="#tab-popular"><?php echo __('Popular', 'Avada'); ?> </a></li> <?php } ?> <?php if ($show_recent_posts == 'true') { ?> <li><a href="#tab-recent"><?php echo __('Recent', 'Avada'); ?> </a></li> <?php } ?> <?php if ($show_comments == 'true') { ?> <li><a href="#tab-comments"><span class="chat-icon"></span></a></li> <?php } ?> </ul> <div class="tab-box tabs-container"> <?php if ($show_popular_posts == 'true') { ?> <div id="tab-popular" class="tab tab_content" style="display: none;"> <?php if ($orderby == 'Highest Comments') { $order_string = '&orderby=comment_count'; } else { $order_string = '&meta_key=avada_post_views_count&orderby=meta_value_num'; } $popular_posts = new WP_Query('showposts=' . $posts . $order_string . '&order=DESC'); if ($popular_posts->have_posts()) { ?> <ul class="news-list"> <?php while ($popular_posts->have_posts()) { $popular_posts->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <div class="image"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('tabs-img'); ?> </a> </div> <?php } ?> <div class="post-holder"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <div class="meta"> <?php the_time($data['date_format']); ?> </div> </div> </li> <?php } ?> </ul> <?php } ?> </div> <?php } ?> <?php if ($show_recent_posts == 'true') { ?> <div id="tab-recent" class="tab tab_content" style="display: none;"> <?php $recent_posts = new WP_Query('showposts=' . $posts); if ($recent_posts->have_posts()) { ?> <ul class="news-list"> <?php while ($recent_posts->have_posts()) { $recent_posts->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <div class="image"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('tabs-img'); ?> </a> </div> <?php } ?> <div class="post-holder"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <div class="meta"> <?php the_time($data['date_format']); ?> </div> </div> </li> <?php } ?> </ul> <?php } ?> </div> <?php } ?> <?php if ($show_comments == 'true') { ?> <div id="tab-comments" class="tab tab_content" style="display: none;"> <ul class="news-list"> <?php $number = $instance['comments']; global $wpdb; $recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}"; $the_comments = $wpdb->get_results($recent_comments); foreach ($the_comments as $comment) { ?> <li> <div class="image"> <a> <?php echo get_avatar($comment, '52'); ?> </a> </div> <div class="post-holder"> <p><?php echo strip_tags($comment->comment_author); ?> <?php _e('says', 'Avada'); ?> :</p> <div class="meta"> <a class="comment-text-side" href="<?php echo get_permalink($comment->ID); ?> #comment-<?php echo $comment->comment_ID; ?> " title="<?php echo strip_tags($comment->comment_author); ?> on <?php echo $comment->post_title; ?> "><?php echo string_limit_words(strip_tags($comment->com_excerpt), 12); ?> ...</a> </div> </div> </li> <?php } ?> </ul> </div> <?php } ?> </div> </div> </div> <?php echo $after_widget; }