Ejemplo n.º 1
0
 function archive($args)
 {
     if (is_paged()) {
         $is_paged = true;
     }
     if (isset($args[0])) {
         $args = $args[0];
     }
     #[0] array level
     bizz_archive_headline();
     $post_count = 0;
     while (have_posts()) {
         #wp
         the_post();
         #wp
         $post_count++;
         $e_o = $post_count % $args['post_columns'] ? '' : ' last';
         $classes = 'post_box top bsize-' . $args['post_columns'] . $e_o;
         $post_classes = implode(' ', get_post_class($classes, get_the_ID()));
         bizz_hook_before_post_box($args);
         #hook
         echo "\t\t\t<" . apply_filters('bizz_html5_article', "div") . " class=\"" . $post_classes . "\" id=\"post-" . get_the_ID() . "\">\n";
         bizz_hook_post_box_top($args);
         #hook
         bizz_headline_area($args);
         bizz_hook_after_headline($args);
         #hook
         bizz_hook_loop_content($args);
         #hook
         bizz_hook_post_box_bottom($args);
         #hook
         echo "\t\t\t</" . apply_filters('bizz_html5_article', "div") . ">\n";
         if ($e_o != '') {
             echo "\t\t\t\t<div class='single-sep fix'><!----></div>\n";
         }
         bizz_hook_after_post_box($args);
         #hook
     }
     if (function_exists('bizz_wp_pagenavi') && $args['enable_pagination']) {
         bizz_wp_pagenavi();
     }
 }
Ejemplo n.º 2
0
 function widget($args, $instance)
 {
     global $wp_version, $widget_id;
     extract($args, EXTR_SKIP);
     /* Arguments for the query. */
     $args = array();
     // general args
     $args['post_author'] = isset($instance['post_author']) ? $instance['post_author'] : false;
     $args['post_date'] = isset($instance['post_date']) ? $instance['post_date'] : false;
     $args['post_comments'] = isset($instance['post_comments']) ? $instance['post_comments'] : false;
     $args['post_categories'] = isset($instance['post_categories']) ? $instance['post_categories'] : false;
     $args['post_tags'] = isset($instance['post_tags']) ? $instance['post_tags'] : false;
     $args['post_edit'] = isset($instance['post_edit']) ? $instance['post_edit'] : false;
     $args['thumb_display'] = isset($instance['thumb_display']) ? $instance['thumb_display'] : false;
     $args['thumb_selflink'] = isset($instance['thumb_selflink']) ? $instance['thumb_selflink'] : false;
     $args['thumb_width'] = intval($instance['thumb_width']);
     $args['thumb_height'] = intval($instance['thumb_height']);
     $args['thumb_align'] = $instance['thumb_align'];
     $args['thumb_cropp'] = $instance['thumb_cropp'];
     $args['thumb_filter'] = $instance['thumb_filter'];
     $args['thumb_sharpen'] = $instance['thumb_sharpen'];
     // archive args
     $args['post_columns'] = $instance['post_columns'];
     $args['remove_posts'] = isset($instance['remove_posts']) ? $instance['remove_posts'] : false;
     $args['full_posts'] = isset($instance['full_posts']) ? $instance['full_posts'] : false;
     $args['read_more'] = isset($instance['read_more']) ? $instance['read_more'] : false;
     $args['read_more_text'] = apply_filters('widget_read_more_text', $instance['read_more_text']);
     /* Widget title and things not in query arguments. */
     $show_entry_title = $instance['show_entry_title'] ? true : false;
     $wp_link_pages = $instance['wp_link_pages'] ? true : false;
     /* Sticky posts. */
     if (version_compare($wp_version, '3.0.9', '>=')) {
         $args['ignore_sticky_posts'] = $instance['caller_get_posts'] ? '1' : '0';
     } else {
         $args['caller_get_posts'] = $instance['caller_get_posts'] ? '1' : '0';
     }
     /* Posts (by post type). */
     $post_types = get_post_types(array('publicly_queryable' => true), 'names');
     $post__in = array();
     foreach ($post_types as $type) {
         if (isset($instance[$type]) && !empty($instance[$type])) {
             $post__in_new = explode(',', $instance[$type]);
             $post__in = array_merge($post__in, $post__in_new);
         }
     }
     if (!empty($post__in)) {
         $args['post__in'] = $post__in;
     }
     /* Taxonomies. */
     $taxonomies = query_posts_get_taxonomies();
     foreach ($taxonomies as $taxonomy) {
         if ('category' == $taxonomy && !empty($instance[$taxonomy])) {
             $args['category__in'] = explode(",", $instance[$taxonomy]);
         } elseif ('post_tag' == $taxonomy && !empty($instance[$taxonomy])) {
             $args['tag__in'] = explode(",", $instance[$taxonomy]);
         } elseif (!empty($instance[$taxonomy])) {
             $the_tax = get_taxonomy($taxonomy);
             $the_term = get_terms($the_tax->query_var, array('include' => $instance[$taxonomy], 'fields' => 'names'));
             $args[$the_tax->query_var] = implode(",", $the_term);
         }
     }
     /* Post type. */
     $post_type = (array) $instance['post_type'];
     if (in_array('any', $post_type)) {
         $args['post_type'] = 'any';
     } else {
         $args['post_type'] = $instance['post_type'];
     }
     /* Post mime type. */
     if (!empty($instance['post_mime_type'])) {
         $args['post_mime_type'] = (array) $instance['post_mime_type'];
     }
     /* Post status. */
     if ($instance['post_status']) {
         $args['post_status'] = join(', ', (array) $instance['post_status']);
     }
     /* Ordering and such. */
     if ($instance['offset']) {
         $args['offset'] = absint($instance['offset']);
         /* fix for offset with pagination */
         global $myoffset;
         $myoffset = $args['offset'];
     }
     if ($instance['posts_per_page']) {
         $args['posts_per_page'] = intval($instance['posts_per_page']);
         /* fix for offset with pagination */
         global $mypppage;
         $mypppage = $args['posts_per_page'];
     }
     if ($instance['post_parent']) {
         $args['post_parent'] = absint($instance['post_parent']);
     }
     /* Paged. */
     if ($instance['enable_pagination']) {
         $args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
         global $paged;
         $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     } else {
         $args['nopaging'] = true;
         $args['paged'] = 1;
         global $paged;
         $paged = 1;
     }
     /* Order and orderby. */
     $args['order'] = $instance['order'];
     $args['orderby'] = $instance['orderby'];
     /* Author arguments. */
     if ($instance['author']) {
         $args['author'] = $instance['author'];
     }
     /* Time arguments. */
     if ($instance['hour']) {
         $args['hour'] = absint($instance['hour']);
     }
     if ($instance['minute']) {
         $args['minute'] = absint($instance['minute']);
     }
     if ($instance['second']) {
         $args['second'] = absint($instance['second']);
     }
     if ($instance['day']) {
         $args['day'] = absint($instance['day']);
     }
     if ($instance['monthnum']) {
         $args['monthnum'] = absint($instance['monthnum']);
     }
     if ($instance['year']) {
         $args['year'] = absint($instance['year']);
     }
     if ($instance['w']) {
         $args['w'] = absint($instance['w']);
     }
     /* Meta arguments. */
     $args['meta_key'] = $instance['meta_key'] ? strip_tags($instance['meta_key']) : '';
     $args['meta_value'] = $instance['meta_value'] ? $instance['meta_value'] : '';
     $args['meta_compare'] = $instance['meta_compare'] ? $instance['meta_compare'] : '';
     /* Open the output of the widget. */
     echo $before_widget;
     echo "<div id=\"content_area_" . preg_replace("/[^0-9\\.]/", '', $widget_id) . "\" class=\"content_area clearfix\">\n";
     /* If there is a title given, add it along with the $before_title and $after_title variables. */
     if ($instance['title']) {
         echo "<div class=\"query_headline\">\n";
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
         echo "</div>\n";
     }
     /* Filter posts to allow offset for pagination */
     add_filter('post_limits', 'bizz_post_limit');
     /* Ignite the query */
     query_posts(apply_filters('query_posts_args', $args));
     /* If posts were found, let's loop through them. */
     if (have_posts()) {
         if (is_paged()) {
             $is_paged = true;
         }
         /* Open wrapper. */
         if ('ol' == $instance['entry_container'] || 'ul' == $instance['entry_container']) {
             echo "<{$instance['entry_container']}>";
         }
         $post_count = 0;
         while (have_posts()) {
             the_post();
             $post_count++;
             /* Post container. */
             $e_o = $post_count % $args['post_columns'] ? '' : ' last';
             $classes = 'post_box top bsize-' . $args['post_columns'] . $e_o;
             $post_classes = implode(' ', get_post_class($classes, get_the_ID()));
             bizz_hook_before_post_box($args);
             #hook
             echo "\t\t\t<" . apply_filters('bizz_html5_article', "div") . " class=\"" . $post_classes . "\" id=\"post-" . get_the_ID() . "\">\n";
             #wp
             bizz_hook_post_box_top($args);
             #hook
             if ($instance['entry_title'] && $show_entry_title && apply_filters('bizz_show_headline_area', true)) {
                 echo "\t\t\t\t<" . apply_filters('bizz_html5_header', "div") . " class=\"headline_area\">\n";
                 if ($wp_link_pages) {
                     the_title("<{$instance['entry_title']} class='entry-title'><a href='" . get_permalink() . "' title='" . the_title_attribute('echo=0') . "' rel='bookmark'>", "</a></{$instance['entry_title']}>");
                 } else {
                     the_title("<{$instance['entry_title']} class='entry-title'>", "</{$instance['entry_title']}>");
                 }
                 echo "\t\t\t\t</" . apply_filters('bizz_html5_header', "div") . ">\n";
             }
             bizz_hook_query_after_headline($args);
             #hook
             bizz_hook_query_content($args);
             #hook
             bizz_hook_post_box_bottom($args);
             #hook
             echo "\t\t\t</" . apply_filters('bizz_html5_article', "div") . ">\n";
             bizz_hook_after_post_box($args);
             #hook
             if ($e_o != '') {
                 echo "\t\t\t\t<div class='single-sep fix'><!----></div>\n";
             }
         }
         /* Pagination */
         if (function_exists('bizz_wp_pagenavi') && $instance['enable_pagination']) {
             bizz_wp_pagenavi();
         }
         /* Close wrapper. */
         if ('ol' == $instance['entry_container'] || 'ul' == $instance['entry_container']) {
             echo "</{$instance['entry_container']}>";
         }
     } elseif ($instance['error_message']) {
         $classes = 'post_box top';
         $post_classes = implode(' ', get_post_class($classes, get_the_ID()));
         bizz_hook_before_post_box($args);
         #hook
         echo "\t\t\t<" . apply_filters('bizz_html5_article', "div") . " class=\"" . $post_classes . "\" id=\"post-" . get_the_ID() . "\">\n";
         #wp
         bizz_hook_post_box_top($args);
         #hook
         /* Output error message. */
         echo '<div class="entry-content"><p>' . do_shortcode(apply_filters('widget_error_message', $instance['error_message'])) . '</p></div>';
         bizz_hook_post_box_bottom($args);
         #hook
         echo "\t\t\t</" . apply_filters('bizz_html5_article', "div") . ">\n";
         bizz_hook_after_post_box($args);
         #hook
     }
     /* Reset query. */
     wp_reset_query();
     /* Remove pagination filter */
     remove_filter('post_limits', 'bizz_post_limit');
     echo "</div>\n";
     /* Close the output of the widget. */
     echo $after_widget;
 }
Ejemplo n.º 3
0
 function woocommerceframework_pagination()
 {
     if (is_search() && is_post_type_archive()) {
         add_filter('woo_pagination_args', 'woocommerceframework_add_search_fragment', 10);
         add_filter('woo_pagination_args_defaults', 'woocommerceframework_woo_pagination_defaults', 10);
     }
     bizz_wp_pagenavi();
 }