<?php get_template_part('includes/navigation'); ?> <?php } ?> </div> <!-- end .entry --> <?php } else { ?> <?php get_template_part('includes/no-results'); ?> <?php } nxt_reset_query(); ?> </div> <!-- end #et_pt_blog --> <?php edit_post_link(esc_html__('Edit this page', 'Modest')); ?> </div> <!-- end .entry --> <?php if (get_option('modest_integration_single_bottom') != '' && get_option('modest_integrate_singlebottom_enable') == 'on') { echo get_option('modest_integration_single_bottom'); } ?>
function widget($args, $instance) { extract($args, EXTR_SKIP); /* Our variables from the widget settings. */ $title = apply_filters('woo_home_blog_title', $instance['title'], $instance, $this->id_base); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $limit = $instance['limit']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title != '') { echo $before_title . $title . $after_title; } // End IF Statement /* Widget content. */ // Add actions for plugins/themes to hook onto. do_action($this->woo_widget_cssclass . '_top'); // Load widget content here. global $woo_options; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $query_args = array('paged' => $paged, 'posts_per_page' => $limit); query_posts($query_args); if (have_posts()) { $count = 0; while (have_posts()) { the_post(); $count++; ?> <div <?php post_class(); ?> > <h2 class="title"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h2> <div class="entry"> <?php the_excerpt(); ?> </div> <?php woo_post_meta(); ?> </div><!-- /.post --> <?php } // End WHILE Loop } else { ?> <div <?php post_class(); ?> > <p><?php _e('Sorry, no posts matched your criteria.', 'woothemes'); ?> </p> </div><!-- /.post --> <?php } nxt_reset_query(); // Add actions for plugins/themes to hook onto. do_action($this->woo_widget_cssclass . '_bottom'); /* After widget (defined by themes). */ echo $after_widget; }
function woo_widget_tabs_latest($posts = 5, $size = 45) { global $post; $latest = get_posts('ignore_sticky_posts=1&numberposts=' . $posts . '&orderby=post_date&order=desc'); foreach ($latest as $post) { setup_postdata($post); ?> <li class="fix"> <?php if ($size != 0) { woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true'); } ?> <a title="<?php the_title(); ?> " href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <span class="meta"><?php the_time(get_option('date_format')); ?> </span> </li> <?php } nxt_reset_query(); }
function woo_display_feedback_entries($args = '') { $defaults = array('limit' => 5, 'orderby' => 'rand', 'order' => 'DESC', 'id' => 0, 'display_author' => true, 'display_url' => true, 'effect' => 'fade', 'pagination' => false, 'echo' => true); $args = nxt_parse_args($args, $defaults); // Allow child themes/plugins to filter here. $args = apply_filters('woo_display_feedback_args', $args); $html = ''; woo_do_atomic('woo_feedback_before', $args); // The Query. $query = woo_get_feedback_entries($args); // The Display. if (!is_nxt_error($query) && is_array($query) && count($query) > 0) { if ($args['effect'] != 'none') { $effect = ' ' . $args['effect']; } $html .= '<div class="feedback' . $effect . '">' . "\n"; $html .= '<div class="feedback-list">' . "\n"; foreach ($query as $post) { setup_postdata($post); $author = ''; $author_text = ''; // If we need to display either the author, URL or both, get the data. if ($args['display_author'] == true || $args['display_url'] == true) { $meta = get_post_custom($post->ID); if (isset($meta['feedback_author']) && $meta['feedback_author'][0] != '' && $args['display_author'] == true) { $author .= '<cite class="feedback-author">' . $meta['feedback_author'][0] . '</cite><!--/.feedback-author-->' . "\n"; } if (isset($meta['feedback_url']) && $meta['feedback_url'][0] != '' && $args['display_url'] == true) { $author .= '<a href="' . $meta['feedback_url'][0] . '" title="' . esc_attr($author_text) . '" class="feedback-url">' . $meta['feedback_url'][0] . '</a>'; } } $html .= '<div id="quote-' . $post->ID . '" class="quote">' . "\n"; $html .= '<blockquote class="feedback-text">' . get_the_content() . '</blockquote>' . "\n"; $html .= $author; $html .= '</div>' . "\n"; } $html .= '</div><!--/.feedback-list-->' . "\n"; if ($args['pagination'] == true && count($query) > 1 && $args['effect'] != 'none') { $html .= '<div class="pagination">' . "\n"; $html .= '<a href="#" class="btn-prev">' . apply_filters('woo_feedback_prev_btn', '← ' . __('Previous', 'woothemes')) . '</a>' . "\n"; $html .= '<a href="#" class="btn-next">' . apply_filters('woo_feedback_next_btn', __('Next', 'woothemes') . ' →') . '</a>' . "\n"; $html .= '</div><!--/.pagination-->' . "\n"; } $html .= '</div><!--/.feedback-->' . "\n"; } // Allow child themes/plugins to filter here. $html = apply_filters('woo_feedback_html', $html, $query); if ($args['echo'] != true) { return $html; } // Should only run is "echo" is set to true. echo $html; woo_do_atomic('woo_feedback_after', $args); // Only if "echo" is set to true. nxt_reset_query(); }
*/ function woo_shortcode_button($atts, $content = null) { extract(shortcode_atts(array('size' => '', 'style' => '', 'bg_color' => '', 'color' => '', 'border' => '', 'text' => '', 'class' => '', 'link' => '#', 'window' => ''), $atts)); // Set custom background and border color $color_output = ''; if ($color) { if ($color == "red" or $color == "orange" or $color == "green" or $color == "aqua" or $color == "teal" or $color == "purple" or $color == "pink" or $color == "silver") { $class .= " " . $color; } else { if ($border) { $border_out = $border; } else { $border_out = $color; } $color_output = 'style="background:' . $color . ';border-color:' . $border_out . '"'; // add custom class $class .= " custom"; } } else { if ($border) { $border_out = $border; } else { $border_out = $bg_color; } $color_output = 'style="background:' . $bg_color . ';border-color:' . $border_out . '"'; // add custom class $class .= " custom"; } // End IF Statement $class_output = ''; // Set text color if ($text) { $class_output .= ' dark'; } // Set class if ($class) { $class_output .= ' ' . $class; } // Set Size if ($size) { $class_output .= ' ' . $size; } if ($window) { $window = 'target="_blank" '; } $output = '<a ' . $window . 'href="' . $link . '" class="woo-sc-button' . $class_output . '" ' . $color_output . '><span class="woo-' . $style . '">' . woo_remove_nxtautop($content) . '</span></a>'; return $output; } add_shortcode('button', 'woo_shortcode_button'); /*-----------------------------------------------------------------------------------*/ /* 4. Related Posts - related_posts /*-----------------------------------------------------------------------------------*/ /* Optional arguments: - limit: number of posts to show (default: 5) - image: thumbnail size, 0 = off (default: 0) */ function woo_shortcode_related_posts($atts) { global $post, $nxt_version; nxt_reset_query(); // Make sure we have a fresh query before we start. $defaults = array('limit' => 5, 'image' => 0, 'float' => 'none'); $atts = shortcode_atts($defaults, $atts); // This function requires at least NXTClass Version 3.1. if ($nxt_version < 3.1) { return _dep_woo_shortcode_related_posts($atts); } else { // Sanitize float attribute. if (isset($atts['float']) && !in_array($atts['float'], array('none', 'left', 'right'))) { $atts['float'] = 'none'; } // Float translation array. $floats = array('none' => '', 'left' => 'fl', 'right' => 'fr'); $css_class = 'woo-sc-related-posts';
function woo_sbm_sidebar($current_sidebar_id) { //Load Settings $woo_sbm_options = get_option('sbm_woo_sbm_options'); $_is_replaced = false; if (is_int($current_sidebar_id)) { $current_sidebar_id = "sidebar-" . $current_sidebar_id; } if (!empty($woo_sbm_options['sidebars'])) { /*------------------------------------------------------------*/ /* Re-order sidebars such that they are replaced appropriately. /* Ordering as follows: /* /* 1. Specific Pages. /* 2. Page Templates. /* 3. Categories. /* 4. Tags. /* 5. Custom Taxonomies. /* 6. Template Hierarchy. /*------------------------------------------------------------*/ $sidebars_by_type = array(); $reordered_sidebars = array(); $custom_taxonomies = array(); $hierarchy_sidebars = array(); $priority = array('page', 'page_template', 'custom_post_type', 'category', 'post_tag', 'taxonomy', 'post_type_archive', 'hierarchy'); // Make sure a conditional is always set for each sidebar. If not, use the "type" instead. foreach ($woo_sbm_options['sidebars'] as $k => $s) { if ($s['conditionals']['conditional'] == '') { $woo_sbm_options['sidebars'][$k]['conditionals']['conditional'] = $s['conditionals']['type']; } } // Separate the sidebars by "conditional". foreach ($woo_sbm_options['sidebars'] as $k => $s) { $sidebars_by_type[$s['conditionals']['conditional']][$k] = $s; } if (!empty($sidebars_by_type)) { foreach ($priority as $key) { if (array_key_exists($key, $sidebars_by_type)) { foreach ($sidebars_by_type[$key] as $k => $s) { $reordered_sidebars[$k] = $s; } unset($sidebars_by_type[$key]); } else { // Place the taxonomies in their own array (there could be any number of custom ones) $custom_taxonomies[$k] = $s; } } } // Add the remaining sidebars at the end. if (count($sidebars_by_type)) { foreach ($sidebars_by_type as $k => $v) { if (count($v) > 0) { foreach ($v as $i => $j) { $reordered_sidebars[$i] = $j; } } } } $woo_sbm_options['sidebars'] = $reordered_sidebars; // Get array of all custom taxonomy keys. $nxt_custom_taxonomy_args = array('_builtin' => false); $woo_nxt_custom_taxonomies = get_taxonomies($nxt_custom_taxonomy_args, 'objects'); $tax_keys = array(); if (count($woo_nxt_custom_taxonomies) > 0) { $tax_keys = array_keys($woo_nxt_custom_taxonomies); } foreach ($woo_sbm_options['sidebars'] as $sidebar) { $id = $sidebar['conditionals']['id']; $type = $sidebar['conditionals']['conditional']; $sidebar_id = $sidebar['conditionals']['sidebar_id']; $sidebar_to_replace = $sidebar['conditionals']['sidebar_to_replace']; $sidebar_piggy = $sidebar['conditionals']['piggy']; if (!empty($sidebar_piggy)) { $sidebar_id = $sidebar_piggy; $sidebar_to_replace = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['sidebar_to_replace']; // $type = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['type']; // Resolves dependencies issue from V4.3.7 when commented out. } // End IF Statement //For query posts in the wild nxt_reset_query(); /*------------------------------------------------------------*/ /* Support for custom post types, if using NXTClass 3.0+. /*------------------------------------------------------------*/ global $nxt_version, $post; $_post_types = array(); if ($nxt_version >= '3.0') { $_args = array('show_ui' => true, 'public' => true, 'publicly_queryable' => true, '_builtin' => false); $_post_types = get_post_types($_args, 'object'); // Set certain post types that aren't allowed to have custom sidebars. $_disallowed_types = array('slide'); // Make the array pluggable. $_disallowed_types = apply_filters('wooframework_sbm_disallowed_posttypes', $_disallowed_types); if (count($_post_types)) { foreach ($_post_types as $k => $v) { if (in_array($k, $_disallowed_types)) { unset($_post_types[$k]); } // End IF Statement } // End FOREACH Loop } // End IF Statement if ($nxt_version >= '3.1') { $_args = array('show_ui' => true, 'public' => true, 'publicly_queryable' => true, '_builtin' => false, 'has_archive' => true); $_post_types = get_post_types($_args, 'object'); } if (count($_post_types)) { foreach ($_post_types as $k => $v) { if (in_array($k, $_disallowed_types)) { unset($_post_types[$k]); } // End IF Statement } // End FOREACH Loop } // End IF Statement } // End IF Statement /* if ( ( $type == 'custom_post_type' && is_single() ) && in_array( $post->post_type, array_keys( $_post_types ) ) ) { if( $post->post_type == $id && $sidebar_id == 'woo_sbm_custom_post_type_' . $id . '_' . $current_sidebar_id ) { if($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } // End IF Statement } else { if ( is_singular() && $sidebar_id == 'woo_sbm_hierarchy_singular_' . $current_sidebar_id ) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } // End IF Statement } // End IF Statement } else { */ // Find conditionals return required sidebar. if ($type == 'page' && !$_is_replaced) { if (is_page() && $id == $post->ID && !is_archive() && !is_home()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } } // End IF Statement if ($type == 'category') { if (is_category($id) || is_single() && in_category($id)) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } } // End IF Statement if ($type == 'post_tag') { $tag_data = get_tag($id); if (is_tag($tag_data->slug)) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } } // End IF Statement if ($type == 'page_template') { if (is_page_template($id)) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } } // End IF Statement if ($type == 'hierarchy' && !$_is_replaced) { if ($id == 'front_page') { if (is_front_page()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'home') { if (is_home()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'single') { if (is_single()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'page') { if (is_page()) { if (!in_array('woo_sbm_page_' . $post->ID . '_' . $sidebar_to_replace, array_keys($woo_sbm_options['sidebars']))) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } } if ($id == 'singular') { if (is_singular()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'date') { if (is_date()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'archive') { if (is_archive()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'category') { if (is_category()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'tag') { if (is_tag()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'tax') { if (is_tax()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'author') { if (is_author()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'search') { if (is_search()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'paged') { if (is_paged()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == 'attach') { if (is_attachment()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } if ($id == '404') { if (is_404()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; } } } } // End IF Statement if ($type == '' || in_array($type, $tax_keys)) { $type_tax = $sidebar['conditionals']['type']; if ($type_tax != '') { // Get taxonomy query object global $nxt_query; $taxonomy_archive_query_obj = $nxt_query->get_queried_object(); if (is_tax($taxonomy_archive_query_obj->name, $taxonomy_archive_query_obj->slug) && $id == $taxonomy_archive_query_obj->term_id) { $sentinel = true; } // End IF Statement if (!$sentinel) { // CUSTOM TAXONOMIES $nxt_custom_taxonomy_args = array('_builtin' => false); $woo_nxt_custom_taxonomies = array(); $woo_nxt_custom_taxonomies = get_taxonomies($nxt_custom_taxonomy_args, 'objects'); $sentinel = false; foreach ($woo_nxt_custom_taxonomies as $woo_nxt_custom_taxonomy) { // checks for match to taxonomy if ($type_tax == $woo_nxt_custom_taxonomy->name) { $term_list = get_the_terms(0, $woo_nxt_custom_taxonomy->name); $term_results = ''; if ($term_list) { foreach ($term_list as $term_item) { if (is_tax($woo_nxt_custom_taxonomy->name, $term_item->slug) && $id == $term_item->term_id) { $sentinel = true; } // End IF Statement } // End FOREACH Loop } // End IF Statement } // End IF Statement } // End FOREACH Loop } // End IF Statement if ($sentinel) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; $_is_replaced = true; } // End IF Statement } // End IF Statement } // End IF Statement } // End IF Statement if ($type == 'post_type_archive' && is_post_type_archive($id)) { if ($sidebar_to_replace == $current_sidebar_id && is_post_type_archive($id)) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } // End IF Statement if ($type == 'custom_post_type' && get_post_type() == $id && is_single()) { if ($sidebar_to_replace == $current_sidebar_id) { $current_sidebar_id = $sidebar_id; // Set this to prevent the system from conflicting with the template hierarchy. $_is_replaced = true; } } // End IF Statement // } // End Custom Post Type IF Statement } // End FOREACH Loop } // End IF Statement return $current_sidebar_id; }
function woo_subscribe_connect($widget = 'false', $title = '', $form = '', $social = '') { //Setup default variables, overriding them if the "Theme Options" have been saved. $settings = array('connect' => 'false', 'connect_title' => __('Subscribe', 'woothemes'), 'connect_related' => 'true', 'connect_content' => __('Subscribe to our e-mail newsletter to receive updates.', 'woothemes'), 'connect_newsletter_id' => '', 'connect_mailchimp_list_url' => '', 'feed_url' => '', 'connect_rss' => '', 'connect_twitter' => '', 'connect_facebook' => '', 'connect_youtube' => '', 'connect_flickr' => '', 'connect_linkedin' => '', 'connect_delicious' => '', 'connect_rss' => '', 'connect_googleplus' => ''); $settings = woo_get_dynamic_values($settings); // Setup title if ($widget != 'true') { $title = $settings['connect_title']; } // Setup related post (not in widget) $related_posts = ''; if ($settings['connect_related'] == "true" and $widget != "true") { $related_posts = do_shortcode('[related_posts limit="5"]'); } ?> <?php if ($settings['connect'] == "true" or $widget == 'true') { ?> <aside id="connect" class="fix"> <h3><?php if ($title) { echo apply_filters('widget_title', $title); } else { _e('Subscribe', 'woothemes'); } ?> </h3> <div <?php if ($related_posts != '') { echo 'class="col-left"'; } ?> > <p><?php if ($settings['connect_content'] != '') { echo stripslashes($settings['connect_content']); } ?> </p> <?php if ($settings['connect_newsletter_id'] != "" and $form != 'on') { ?> <form class="newsletter-form<?php if ($related_posts == '') { echo ' fl'; } ?> " action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open( 'http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $settings['connect_newsletter_id']; ?> ', 'popupwindow', 'scrollbars=yes,width=550,height=520' );return true"> <input class="email" type="text" name="email" value="<?php esc_attr_e('E-mail', 'woothemes'); ?> " onfocus="if (this.value == '<?php _e('E-mail', 'woothemes'); ?> ') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('E-mail', 'woothemes'); ?> ';}" /> <input type="hidden" value="<?php echo $settings['connect_newsletter_id']; ?> " name="uri"/> <input type="hidden" value="<?php bloginfo('name'); ?> " name="title"/> <input type="hidden" name="loc" value="en_US"/> <input class="submit" type="submit" name="submit" value="<?php _e('Submit', 'woothemes'); ?> " /> </form> <?php } ?> <?php if ($settings['connect_mailchimp_list_url'] != "" and $form != 'on' and $settings['connect_newsletter_id'] == "") { ?> <!-- Begin MailChimp Signup Form --> <div id="mc_embed_signup"> <form class="newsletter-form<?php if ($related_posts == '') { echo ' fl'; } ?> " action="<?php echo $settings['connect_mailchimp_list_url']; ?> " method="post" target="popupwindow" onsubmit="window.open('<?php echo $settings['connect_mailchimp_list_url']; ?> ', 'popupwindow', 'scrollbars=yes,width=650,height=520');return true"> <input type="text" name="EMAIL" class="required email" value="<?php _e('E-mail', 'woothemes'); ?> " id="mce-EMAIL" onfocus="if (this.value == '<?php _e('E-mail', 'woothemes'); ?> ') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('E-mail', 'woothemes'); ?> ';}"> <input type="submit" value="<?php _e('Submit', 'woothemes'); ?> " name="subscribe" id="mc-embedded-subscribe" class="btn submit button"> </form> </div> <!--End mc_embed_signup--> <?php } ?> <?php if ($social != 'on') { ?> <div class="social<?php if ($related_posts == '' and $settings['connect_newsletter_id'] != "") { echo ' fr'; } ?> "> <?php if ($settings['connect_rss'] == "true") { ?> <a href="<?php if ($settings['feed_url']) { echo esc_url($settings['feed_url']); } else { echo get_bloginfo_rss('rss2_url'); } ?> " class="subscribe" title="RSS"></a> <?php } if ($settings['connect_twitter'] != "") { ?> <a href="<?php echo esc_url($settings['connect_twitter']); ?> " class="twitter" title="Twitter"></a> <?php } if ($settings['connect_facebook'] != "") { ?> <a href="<?php echo esc_url($settings['connect_facebook']); ?> " class="facebook" title="Facebook"></a> <?php } if ($settings['connect_youtube'] != "") { ?> <a href="<?php echo esc_url($settings['connect_youtube']); ?> " class="youtube" title="YouTube"></a> <?php } if ($settings['connect_flickr'] != "") { ?> <a href="<?php echo esc_url($settings['connect_flickr']); ?> " class="flickr" title="Flickr"></a> <?php } if ($settings['connect_linkedin'] != "") { ?> <a href="<?php echo esc_url($settings['connect_linkedin']); ?> " class="linkedin" title="LinkedIn"></a> <?php } if ($settings['connect_delicious'] != "") { ?> <a href="<?php echo esc_url($settings['connect_delicious']); ?> " class="delicious" title="Delicious"></a> <?php } if ($settings['connect_googleplus'] != "") { ?> <a href="<?php echo esc_url($settings['connect_googleplus']); ?> " class="googleplus" title="Google+"></a> <?php } ?> </div> <?php } ?> </div><!-- col-left --> <?php if ($settings['connect_related'] == "true" and $related_posts != '') { ?> <div class="related-posts col-right"> <h4><?php _e('Related Posts:', 'woothemes'); ?> </h4> <?php echo $related_posts; ?> </div><!-- col-right --> <?php nxt_reset_query(); } ?> </aside> <?php } }
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; }
function widget($args, $instance) { extract($args, EXTR_SKIP); /* Our variables from the widget settings. */ $title = apply_filters('woo_home_portfolio_title', $instance['title'], $instance, $this->id_base); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $limit = $instance['limit']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title != '') { echo $before_title . $title . $after_title; } // End IF Statement /* Widget content. */ // Add actions for plugins/themes to hook onto. do_action($this->woo_widget_cssclass . '_top'); // Load widget content here. global $woo_options; $query_args = array('post_type' => 'portfolio', 'posts_per_page' => $limit, 'orderby' => 'menu_order', 'order' => 'asc'); query_posts($query_args); if (have_posts()) { while (have_posts()) { the_post(); echo '<div id="portfolio-item-id-' . get_the_ID() . '" class="' . join(' ', get_post_class('portfolio-item')) . '">' . "\n"; echo '<div class="portfolio-image drop-shadow lifted">' . woo_image('return=true&key=portfolio-image&width=240&height=150') . '</div><!--/.portfolio-image-->' . "\n"; the_title('<h3><a href="' . get_permalink(get_the_ID()) . '">', '</a></h3>' . "\n"); echo get_the_term_list(get_the_ID(), 'portfolio-gallery', '<span class="portfolio-galleries">', ', ', '</span><!--/.portfolio-galleries-->' . "\n"); echo '</div>' . "\n"; } } nxt_reset_query(); // Add actions for plugins/themes to hook onto. do_action($this->woo_widget_cssclass . '_bottom'); /* After widget (defined by themes). */ echo $after_widget; }
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; }