/**
  * Performs post queries for internal linking.
  *
  * @since 3.1.0
  *
  * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
  * @return array Results.
  */
 public static function nxt_link_query($args = array())
 {
     $pts = get_post_types(array('public' => true), 'objects');
     $pt_names = array_keys($pts);
     $query = array('post_type' => $pt_names, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'post_date', 'posts_per_page' => 20);
     $args['pagenum'] = isset($args['pagenum']) ? absint($args['pagenum']) : 1;
     if (isset($args['s'])) {
         $query['s'] = $args['s'];
     }
     $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ($args['pagenum'] - 1) : 0;
     // Do main query.
     $get_posts = new nxt_Query();
     $posts = $get_posts->query($query);
     // Check if any posts were found.
     if (!$get_posts->post_count) {
         return false;
     }
     // Build results.
     $results = array();
     foreach ($posts as $post) {
         if ('post' == $post->post_type) {
             $info = mysql2date(__('Y/m/d'), $post->post_date);
         } else {
             $info = $pts[$post->post_type]->labels->singular_name;
         }
         $results[] = array('ID' => $post->ID, 'title' => trim(esc_html(strip_tags(get_the_title($post)))), 'permalink' => get_permalink($post->ID), 'info' => $info);
     }
     return $results;
 }
    function widget($args, $instance)
    {
        $cache = nxt_cache_get('widget_recent_posts', '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;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
        if (empty($instance['number']) || !($number = absint($instance['number']))) {
            $number = 10;
        }
        $r = new nxt_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
        if ($r->have_posts()) {
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
		<ul>
		<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
		<li><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
"><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                ?>
</a></li>
		<?php 
            }
            ?>
		</ul>
		<?php 
            echo $after_widget;
            // Reset the global $the_post as this query will have stomped on it
            nxt_reset_postdata();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        nxt_cache_set('widget_recent_posts', $cache, 'widget');
    }
Exemple #3
0
/**
 * Retrieve the autosaved data of the specified post.
 *
 * Returns a post object containing the information that was autosaved for the
 * specified post.
 *
 * @package NXTClass
 * @subpackage Post_Revisions
 * @since 2.6.0
 *
 * @param int $post_id The post ID.
 * @return object|bool The autosaved data or false on failure or when no autosave exists.
 */
function nxt_get_post_autosave($post_id)
{
    if (!($post = get_post($post_id))) {
        return false;
    }
    $q = array('name' => "{$post->ID}-autosave", 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit');
    // Use nxt_Query so that the result gets cached
    $autosave_query = new nxt_Query();
    add_action('parse_query', '_nxt_get_post_autosave_hack');
    $autosave = $autosave_query->query($q);
    remove_action('parse_query', '_nxt_get_post_autosave_hack');
    if ($autosave && is_array($autosave) && is_object($autosave[0])) {
        return $autosave[0];
    }
    return false;
}
function woo_get_posts_by_taxonomy($args = null)
{
    global $nxt_query;
    $posts = array();
    /* Parse arguments, and declare individual variables for each. */
    $defaults = array('limit' => 5, 'post_type' => 'any', 'taxonomies' => 'post_tag, category', 'specific_terms' => '', 'relationship' => 'OR', 'order' => 'DESC', 'orderby' => 'date', 'operator' => 'IN', 'exclude' => '');
    $args = nxt_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    // Make sure the order value is safe.
    if (!in_array($order, array('ASC', 'DESC'))) {
        $order = $defaults['order'];
    }
    // Make sure the orderby value is safe.
    if (!in_array($orderby, array('none', 'id', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order'))) {
        $orderby = $defaults['orderby'];
    }
    // Make sure the operator value is safe.
    if (!in_array($operator, array('IN', 'NOT IN', 'AND'))) {
        $orderby = $defaults['operator'];
    }
    // Convert our post types to an array.
    if (!is_array($post_type)) {
        $post_type = explode(',', $post_type);
    }
    // Convert our taxonomies to an array.
    if (!is_array($taxonomies)) {
        $taxonomies = explode(',', $taxonomies);
    }
    // Convert exclude to an array.
    if (!is_array($exclude) && $exclude != '') {
        $exclude = explode(',', $exclude);
    }
    if (!count((array) $taxonomies)) {
        return;
    }
    // Clean up our taxonomies for use in the query.
    if (count($taxonomies)) {
        foreach ($taxonomies as $k => $v) {
            $taxonomies[$k] = trim($v);
        }
    }
    // Determine which terms we're going to relate to this entry.
    $related_terms = array();
    foreach ($taxonomies as $t) {
        $terms = get_terms($t, 'orderby=id&hide_empty=1');
        if (!empty($terms)) {
            foreach ($terms as $k => $v) {
                $related_terms[$t][$v->term_id] = $v->slug;
            }
        }
    }
    // If specific terms are available, use those.
    if (!is_array($specific_terms)) {
        $specific_terms = explode(',', $specific_terms);
    }
    if (count($specific_terms)) {
        foreach ($specific_terms as $k => $v) {
            $specific_terms[$k] = trim($v);
        }
    }
    // Look for posts with the same terms.
    // Setup query arguments.
    $query_args = array();
    if ($post_type) {
        $query_args['post_type'] = $post_type;
    }
    if ($limit) {
        $query_args['posts_per_page'] = $limit;
        // $query_args['nopaging'] = true;
    }
    // Setup specific posts to exclude.
    if (count($exclude) > 0) {
        $query_args['post__not_in'] = $exclude;
    }
    $query_args['order'] = $order;
    $query_args['orderby'] = $orderby;
    $query_args['tax_query'] = array();
    // Setup for multiple taxonomies.
    if (count($related_terms) > 1) {
        $query_args['tax_query']['relation'] = $args['relationship'];
    }
    // Add the taxonomies to the query arguments.
    foreach ((array) $related_terms as $k => $v) {
        $terms_for_search = array_values($v);
        if (count($specific_terms)) {
            $specific_terms_by_tax = array();
            foreach ($specific_terms as $i => $j) {
                if (in_array($j, array_values($v))) {
                    $specific_terms_by_tax[] = $j;
                }
            }
            if (count($specific_terms_by_tax)) {
                $terms_for_search = $specific_terms_by_tax;
            }
        }
        $query_args['tax_query'][] = array('taxonomy' => $k, 'field' => 'slug', 'terms' => $terms_for_search, 'operator' => $operator);
    }
    if (empty($query_args['tax_query'])) {
        return;
    }
    $query_saved = $nxt_query;
    $query = new nxt_Query($query_args);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $posts[] = $query->post;
        }
    }
    $query = $query_saved;
    nxt_reset_query();
    return $posts;
}
Exemple #5
0
/**
 * Get the menu items associated with a particular object.
 *
 * @since 3.0.0
 *
 * @param int $object_id The ID of the original object.
 * @param string $object_type The type of object, such as "taxonomy" or "post_type."
 * @return array The array of menu item IDs; empty array if none;
 */
function nxt_get_associated_nav_menu_items($object_id = 0, $object_type = 'post_type')
{
    $object_id = (int) $object_id;
    $menu_item_ids = array();
    $query = new nxt_Query();
    $menu_items = $query->query(array('meta_key' => '_menu_item_object_id', 'meta_value' => $object_id, 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'posts_per_page' => -1));
    foreach ((array) $menu_items as $menu_item) {
        if (isset($menu_item->ID) && is_nav_menu_item($menu_item->ID)) {
            if (get_post_meta($menu_item->ID, '_menu_item_type', true) != $object_type) {
                continue;
            }
            $menu_item_ids[] = (int) $menu_item->ID;
        }
    }
    return array_unique($menu_item_ids);
}
Exemple #6
0
/**
 * Displays a metabox for a post type menu item.
 *
 * @since 3.0.0
 *
 * @param string $object Not used.
 * @param string $post_type The post type object.
 */
function nxt_nav_menu_item_post_type_meta_box($object, $post_type)
{
    global $_nav_menu_placeholder, $nav_menu_selected_id;
    $post_type_name = $post_type['args']->name;
    // paginate browsing for large numbers of post objects
    $per_page = 50;
    $pagenum = isset($_REQUEST[$post_type_name . '-tab']) && isset($_REQUEST['paged']) ? absint($_REQUEST['paged']) : 1;
    $offset = 0 < $pagenum ? $per_page * ($pagenum - 1) : 0;
    $args = array('offset' => $offset, 'order' => 'ASC', 'orderby' => 'title', 'posts_per_page' => $per_page, 'post_type' => $post_type_name, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false);
    if (isset($post_type['args']->_default_query)) {
        $args = array_merge($args, (array) $post_type['args']->_default_query);
    }
    // @todo transient caching of these results with proper invalidation on updating of a post of this type
    $get_posts = new nxt_Query();
    $posts = $get_posts->query($args);
    if (!$get_posts->post_count) {
        echo '<p>' . __('No items.') . '</p>';
        return;
    }
    $post_type_object = get_post_type_object($post_type_name);
    $num_pages = $get_posts->max_num_pages;
    $page_links = paginate_links(array('base' => add_query_arg(array($post_type_name . '-tab' => 'all', 'paged' => '%#%', 'item-type' => 'post_type', 'item-object' => $post_type_name)), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $num_pages, 'current' => $pagenum));
    if (!$posts) {
        $error = '<li id="error">' . $post_type['args']->labels->not_found . '</li>';
    }
    $db_fields = false;
    if (is_post_type_hierarchical($post_type_name)) {
        $db_fields = array('parent' => 'post_parent', 'id' => 'ID');
    }
    $walker = new Walker_Nav_Menu_Checklist($db_fields);
    $current_tab = 'most-recent';
    if (isset($_REQUEST[$post_type_name . '-tab']) && in_array($_REQUEST[$post_type_name . '-tab'], array('all', 'search'))) {
        $current_tab = $_REQUEST[$post_type_name . '-tab'];
    }
    if (!empty($_REQUEST['quick-search-posttype-' . $post_type_name])) {
        $current_tab = 'search';
    }
    $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_nxtnonce');
    ?>
	<div id="posttype-<?php 
    echo $post_type_name;
    ?>
" class="posttypediv">
		<ul id="posttype-<?php 
    echo $post_type_name;
    ?>
-tabs" class="posttype-tabs add-menu-item-tabs">
			<li <?php 
    echo 'most-recent' == $current_tab ? ' class="tabs"' : '';
    ?>
><a class="nav-tab-link" href="<?php 
    if ($nav_menu_selected_id) {
        echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args)));
    }
    ?>
#tabs-panel-posttype-<?php 
    echo $post_type_name;
    ?>
-most-recent"><?php 
    _e('Most Recent');
    ?>
</a></li>
			<li <?php 
    echo 'all' == $current_tab ? ' class="tabs"' : '';
    ?>
><a class="nav-tab-link" href="<?php 
    if ($nav_menu_selected_id) {
        echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args)));
    }
    ?>
#<?php 
    echo $post_type_name;
    ?>
-all"><?php 
    _e('View All');
    ?>
</a></li>
			<li <?php 
    echo 'search' == $current_tab ? ' class="tabs"' : '';
    ?>
><a class="nav-tab-link" href="<?php 
    if ($nav_menu_selected_id) {
        echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args)));
    }
    ?>
#tabs-panel-posttype-<?php 
    echo $post_type_name;
    ?>
-search"><?php 
    _e('Search');
    ?>
</a></li>
		</ul>

		<div id="tabs-panel-posttype-<?php 
    echo $post_type_name;
    ?>
-most-recent" class="tabs-panel <?php 
    echo 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive';
    ?>
">
			<ul id="<?php 
    echo $post_type_name;
    ?>
checklist-most-recent" class="categorychecklist form-no-clear">
				<?php 
    $recent_args = array_merge($args, array('orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15));
    $most_recent = $get_posts->query($recent_args);
    $args['walker'] = $walker;
    echo walk_nav_menu_tree(array_map('nxt_setup_nav_menu_item', $most_recent), 0, (object) $args);
    ?>
			</ul>
		</div><!-- /.tabs-panel -->

		<div class="tabs-panel <?php 
    echo 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive';
    ?>
" id="tabs-panel-posttype-<?php 
    echo $post_type_name;
    ?>
-search">
			<?php 
    if (isset($_REQUEST['quick-search-posttype-' . $post_type_name])) {
        $searched = esc_attr($_REQUEST['quick-search-posttype-' . $post_type_name]);
        $search_results = get_posts(array('s' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC'));
    } else {
        $searched = '';
        $search_results = array();
    }
    ?>
			<p class="quick-search-wrap">
				<input type="text" class="quick-search input-with-default-title" title="<?php 
    esc_attr_e('Search');
    ?>
" value="<?php 
    echo $searched;
    ?>
" name="quick-search-posttype-<?php 
    echo $post_type_name;
    ?>
" />
				<img class="waiting" src="<?php 
    echo esc_url(admin_url('images/nxtspin_light.gif'));
    ?>
" alt="" />
				<?php 
    submit_button(__('Search'), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array('id' => 'submit-quick-search-posttype-' . $post_type_name));
    ?>
			</p>

			<ul id="<?php 
    echo $post_type_name;
    ?>
-search-checklist" class="list:<?php 
    echo $post_type_name;
    ?>
 categorychecklist form-no-clear">
			<?php 
    if (!empty($search_results) && !is_nxt_error($search_results)) {
        ?>
				<?php 
        $args['walker'] = $walker;
        echo walk_nav_menu_tree(array_map('nxt_setup_nav_menu_item', $search_results), 0, (object) $args);
        ?>
			<?php 
    } elseif (is_nxt_error($search_results)) {
        ?>
				<li><?php 
        echo $search_results->get_error_message();
        ?>
</li>
			<?php 
    } elseif (!empty($searched)) {
        ?>
				<li><?php 
        _e('No results found.');
        ?>
</li>
			<?php 
    }
    ?>
			</ul>
		</div><!-- /.tabs-panel -->


		<div id="<?php 
    echo $post_type_name;
    ?>
-all" class="tabs-panel tabs-panel-view-all <?php 
    echo 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive';
    ?>
">
			<?php 
    if (!empty($page_links)) {
        ?>
				<div class="add-menu-item-pagelinks">
					<?php 
        echo $page_links;
        ?>
				</div>
			<?php 
    }
    ?>
			<ul id="<?php 
    echo $post_type_name;
    ?>
checklist" class="list:<?php 
    echo $post_type_name;
    ?>
 categorychecklist form-no-clear">
				<?php 
    $args['walker'] = $walker;
    // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
    if ('page' == $post_type_name) {
        $front_page = 'page' == get_option('show_on_front') ? (int) get_option('page_on_front') : 0;
        if (!empty($front_page)) {
            $front_page_obj = get_post($front_page);
            $front_page_obj->_add_to_top = true;
            $front_page_obj->label = sprintf(_x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title);
            array_unshift($posts, $front_page_obj);
        } else {
            $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? intval($_nav_menu_placeholder) - 1 : -1;
            array_unshift($posts, (object) array('_add_to_top' => true, 'ID' => 0, 'object_id' => $_nav_menu_placeholder, 'post_content' => '', 'post_excerpt' => '', 'post_parent' => '', 'post_title' => _x('Home', 'nav menu home label'), 'post_type' => 'nav_menu_item', 'type' => 'custom', 'url' => home_url('/')));
        }
    }
    $posts = apply_filters('nav_menu_items_' . $post_type_name, $posts, $args, $post_type);
    $checkbox_items = walk_nav_menu_tree(array_map('nxt_setup_nav_menu_item', $posts), 0, (object) $args);
    if ('all' == $current_tab && !empty($_REQUEST['selectall'])) {
        $checkbox_items = preg_replace('/(type=(.)checkbox(\\2))/', '$1 checked=$2checked$2', $checkbox_items);
    }
    echo $checkbox_items;
    ?>
			</ul>
			<?php 
    if (!empty($page_links)) {
        ?>
				<div class="add-menu-item-pagelinks">
					<?php 
        echo $page_links;
        ?>
				</div>
			<?php 
    }
    ?>
		</div><!-- /.tabs-panel -->


		<p class="button-controls">
			<span class="list-controls">
				<a href="<?php 
    echo esc_url(add_query_arg(array($post_type_name . '-tab' => 'all', 'selectall' => 1), remove_query_arg($removed_args)));
    ?>
#posttype-<?php 
    echo $post_type_name;
    ?>
" class="select-all"><?php 
    _e('Select All');
    ?>
</a>
			</span>

			<span class="add-to-menu">
				<img class="waiting" src="<?php 
    echo esc_url(admin_url('images/nxtspin_light.gif'));
    ?>
" alt="" />
				<input type="submit"<?php 
    disabled($nav_menu_selected_id, 0);
    ?>
 class="button-secondary submit-add-to-menu" value="<?php 
    esc_attr_e('Add to Menu');
    ?>
" name="add-post-type-menu-item" id="submit-posttype-<?php 
    echo $post_type_name;
    ?>
" />
			</span>
		</p>

	</div><!-- /.posttypediv -->
	<?php 
}
    function widget($args, $instance)
    {
        $cache = nxt_cache_get('widget_recent_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'huddle') : $instance['title'], $instance, $this->id_base);
        if (!($number = absint($instance['number']))) {
            $number = 10;
        }
        $thumbs = isset($instance['thumbs']) && $instance['thumbs'];
        $show = isset($instance['show']) ? $instance['show'] : 'recent';
        $nxtq_args = array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true);
        if ($show == 'popular') {
            $nxtq_args['orderby'] = 'comment_count';
        }
        $r = new nxt_Query($nxtq_args);
        if ($r->have_posts()) {
            ?>
			<?php 
            echo $before_widget;
            ?>
			<?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
			<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
				<div class="post">
					<div class="post-img fl"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('post-small');
                ?>
</a></div>
					<h4 class="post-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
					<span>
						<?php 
                _e('On', 'huddle');
                ?>
						<?php 
                the_time(get_option('date_format'));
                ?>
,
						<?php 
                _e('with', 'huddle');
                ?>
						<?php 
                comments_popup_link(__('0 Comments', 'huddle'), __('1 Comment', 'huddle'), __('% Comments', 'huddle'));
                ?>
					</span>
					<div class="clf"></div>
				</div><!--post-->
			<?php 
            }
            ?>
			<?php 
            echo $after_widget;
            ?>
			<?php 
            // Reset the global $the_post as this query will have stomped on it
            nxt_reset_postdata();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        nxt_cache_set('widget_recent_posts', $cache, 'widget');
    }
/**
 * Infinity Theme: loop blog template
 *
 * The loop that displays posts
 * 
 * @author Bowe Frankema <*****@*****.**>
 * @link http://infinity.presscrew.com/
 * @copyright Copyright (C) 2010-2011 Bowe Frankema
 * @license http://www.gnu.org/licenses/gpl.html GPLv2 or later
 * @package Infinity
 * @subpackage templates
 * @since 1.0
 */
$temp = $nxt_query;
$nxt_query = null;
$nxt_query = new nxt_Query();
$nxt_query->query('posts_per_page=5' . '&paged=' . $paged);
while ($nxt_query->have_posts()) {
    $nxt_query->the_post();
    ?>
		<!-- post -->
		<article class="post" id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>
			<?php 
    do_action('open_loop_post');
    ?>
 <?php 
        the_category(', ');
    }
    if (in_array('comments', get_option('modest_postinfo1'))) {
        ?>
 | <?php 
        comments_popup_link(esc_html__('0 comments', 'Modest'), esc_html__('1 comment', 'Modest'), '% ' . esc_html__('comments', 'Modest'));
    }
    ?>
</p>
<?php 
} elseif (is_single() && get_option('modest_postinfo2') != '') {
    ?>
	<?php 
    global $query_string;
    $new_query = new nxt_Query($query_string);
    while ($new_query->have_posts()) {
        $new_query->the_post();
    }
    ?>
		<?php 
    esc_html_e('Posted', 'Modest');
    ?>
 <?php 
    if (in_array('author', get_option('modest_postinfo2'))) {
        ?>
 <?php 
        esc_html_e('by', 'Modest');
        ?>
 <?php 
        the_author_posts_link();
    function widget($args, $instance)
    {
        global $nxtdb;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $title_popular = $instance['title_popular'];
        $title_recent = $instance['title_recent'];
        $title_comments = $instance['title_comments'];
        $display_count = $instance['display_count'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
			<ul class="tabs">
				<li><a class="btn-small"><span><?php 
        echo $title_popular;
        ?>
</span></a></li>
				<li><a><span><?php 
        echo $title_recent;
        ?>
</span></a></li>
				<li><a><span><?php 
        echo $title_comments;
        ?>
</span></a></li>
			</ul>
			<div class="clear"></div>
			<div class="panes">
			
				<?php 
        // Popular Posts
        $huddle_popular_posts = new nxt_Query();
        $huddle_popular_posts->query('shonxtosts=' . $display_count . '&orderby=comment_count');
        ?>
				<div class="pane">
					<?php 
        // Start the loop
        while ($huddle_popular_posts->have_posts()) {
            $huddle_popular_posts->the_post();
            ?>
					<div class="post">
						<div class="post-img fl"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_post_thumbnail('post-small');
            ?>
</a></div>
						<h4 class="post-title"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
						<span>
							<?php 
            _e('On', 'huddle');
            ?>
							<?php 
            the_time(get_option('date_format'));
            ?>
,
							<?php 
            _e('with', 'huddle');
            ?>
							<?php 
            comments_popup_link(__('0 Comments', 'huddle'), __('1 Comment', 'huddle'), __('% Comments', 'huddle'));
            ?>
						</span>
						<div class="clf"></div>
					</div><!--post-->
					<?php 
            // End the loop
        }
        nxt_reset_query();
        ?>
				</div><!--pane-->	
						
				<?php 
        // Recent Posts
        $huddle_recent_posts = new nxt_Query();
        $huddle_recent_posts->query('shonxtosts=' . $display_count . '');
        ?>
				<div class="pane">
					<?php 
        // Start the loop
        while ($huddle_recent_posts->have_posts()) {
            $huddle_recent_posts->the_post();
            ?>
					<div class="post">
						<div class="post-img fl"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_post_thumbnail('post-small');
            ?>
</a></div>
						<h4 class="post-title"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
						<span>
							<?php 
            _e('On', 'huddle');
            ?>
							<?php 
            the_time(get_option('date_format'));
            ?>
,
							<?php 
            _e('with', 'huddle');
            ?>
							<?php 
            comments_popup_link(__('0 Comments', 'huddle'), __('1 Comment', 'huddle'), __('% Comments', 'huddle'));
            ?>
						</span>
						<div class="clf"></div>
					</div><!--post-->
					<?php 
            // End the loop
        }
        nxt_reset_query();
        ?>
				</div><!--pane-->
				
				<?php 
        // Recent Comments
        ?>
				<div class="pane">
				<?php 
        // Query for comments
        global $nxtdb;
        $huddle_recent_comments_query = "SELECT DISTINCT ID, post_title, post_password, comment_ID,\n\t\t\t\tcomment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,\n\t\t\t\tcomment_type,comment_author_url,\n\t\t\t\tSUBSTRING(comment_content,1,50) AS comment_excerpt\n\t\t\t\tFROM {$nxtdb->comments}\n\t\t\t\tLEFT OUTER JOIN {$nxtdb->posts} ON ({$nxtdb->comments}.comment_post_ID =\n\t\t\t\t{$nxtdb->posts}.ID)\n\t\t\t\tWHERE comment_approved = '1' AND comment_type = '' AND\n\t\t\t\tpost_password = ''\n\t\t\t\tORDER BY comment_date_gmt DESC LIMIT " . $display_count;
        $huddle_recent_comments = $nxtdb->get_results($huddle_recent_comments_query);
        foreach ($huddle_recent_comments as $huddle_recent_comment) {
            ?>
					<div class="post clf">
						<div class="post-img"><?php 
            echo get_avatar($huddle_recent_comment, 35);
            ?>
</div>
						<div class="post-txt">
							<h4 class="post-title"><a href="<?php 
            echo get_permalink($huddle_recent_comment->ID);
            ?>
#comment-<?php 
            echo $huddle_recent_comment->comment_ID;
            ?>
"><?php 
            echo strip_tags($huddle_recent_comment->comment_author);
            ?>
</a></h4>
							<span class="em"><?php 
            echo strip_tags($huddle_recent_comment->comment_excerpt);
            ?>
...</span>
						</div>
					</div><!--post-->
				<?php 
        }
        ?>
				</div><!--pane-->
			</div><!--panes-->
		
		<?php 
        echo $after_widget;
    }