function _print_blog_category_lists($layout_type, $column = 4)
        {
            global $wpdb, $wp_query, $sidebar_layout, $fullwidth_layout;
            $parentLayout = $fullwidth_layout ? 'fullwidth' : 'content-sidebar';
            $content = '';
            if ($parentLayout == 'fullwidth') {
                switch ($layout_type) {
                    case 'default':
                        $content .= '<div class="wrap_940 plus_padding">' . "\n";
                        if (have_posts()) {
                            while (have_posts()) {
                                the_post();
                                global $post;
                                $ccat = get_the_category();
                                $ct = '';
                                foreach ($ccat as $a => $cct) {
                                    if ($a != 0) {
                                        $ct .= ', ';
                                    }
                                    $ct .= '<a href="' . get_category_link($cct->term_id) . '">' . $cct->cat_name . '</a>';
                                }
                                $num_comments = get_comments_number();
                                $write_comments = "";
                                if (comments_open()) {
                                    if ($num_comments == 0) {
                                        $comments = __('0 Comments', 'wip');
                                    } elseif ($num_comments > 1) {
                                        $comments = $num_comments . __(' Comments', 'wip');
                                    } else {
                                        $comments = __('1 Comment', 'wip');
                                    }
                                    $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
                                } else {
                                    $write_comments = __('Comment Off', 'wip');
                                }
                                $content .= '<div class="fullwidth-blog-lists">' . "\n";
                                /** post with thumbnail */
                                if (has_post_thumbnail() && wip_get_attached_file($post->ID)) {
                                    $content .= '<div class="fullwidth-blog-excerpt">' . "\n";
                                    $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n";
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                    $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                    $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . __('Continue Reading', 'wip') . ' &rarr;</a>' . "\n";
                                    $content .= '</div>' . "\n";
                                    $content .= '<div class="fullwidth-blog-thumbnail">' . "\n";
                                    $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n";
                                    $content .= '<img src="' . wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 460, 220) . '" alt="' . the_title_attribute('echo=0') . '"/>';
                                    $content .= '</a>' . "\n";
                                    $content .= '</div>' . "\n";
                                    $content .= '<div class="clear"></div>' . "\n";
                                } else {
                                    $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n";
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                    $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                    $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . __('Continue Reading', 'wip') . ' &rarr;</a>' . "\n";
                                }
                                $content .= '</div>' . "\n";
                            }
                            $content .= wip_pagenavi('', false);
                        } else {
                            $content .= __('No Posts Found!', 'wip');
                        }
                        wp_reset_postdata();
                        $content .= '</div><!-- end .wrap_940 -->' . "\n";
                        break;
                    case 'column':
                        if (have_posts()) {
                            $content .= '<div class="col_wraper no_margin">' . "\n";
                            $intloop = 0;
                            while (have_posts()) {
                                the_post();
                                $intloop++;
                                global $post;
                                $colClass = 'col_four';
                                $colImage = "";
                                switch ($column) {
                                    case '4':
                                        $colClass = 'col_four';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 220, 120) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                    case '3':
                                        $colClass = 'col_three';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 300, 166) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                    case '2':
                                        $colClass = 'col_two';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 460, 258) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                }
                                $ccat = get_the_category();
                                $ct = '';
                                foreach ($ccat as $a => $cct) {
                                    if ($a != 0) {
                                        $ct .= ', ';
                                    }
                                    $ct .= '<a href="' . get_category_link($cct->term_id) . '">' . $cct->cat_name . '</a>';
                                }
                                $num_comments = get_comments_number();
                                $write_comments = "";
                                if (comments_open()) {
                                    if ($num_comments == 0) {
                                        $comments = __('0 Comments', 'wip');
                                    } elseif ($num_comments > 1) {
                                        $comments = $num_comments . __(' Comments', 'wip');
                                    } else {
                                        $comments = __('1 Comment', 'wip');
                                    }
                                    $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
                                } else {
                                    $write_comments = __('Comment Off', 'wip');
                                }
                                $content .= '<div class="full-column-blog-lists ' . $colClass . ' float_left">' . "\n";
                                $content .= '<div class="full-column-blog-thumbnail">' . "\n";
                                $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n";
                                $content .= '<img src="' . $colImage . '" alt="' . the_title_attribute('echo=0') . '"/>';
                                $content .= '</a>' . "\n";
                                $content .= '</div>' . "\n";
                                $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n";
                                if ($column == '4') {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '</span>' . "\n";
                                } else {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                }
                                if ($column == '2') {
                                    $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                } else {
                                    $content .= wpautop(limit_text(get_the_excerpt(), 120, '...'));
                                }
                                $content .= '</div>' . "\n";
                                if ($intloop % $column == 0) {
                                    $content .= '<div class="clear"></div>' . "\n";
                                }
                            }
                            if ($intloop % $column != 0) {
                                $content .= '<div class="clear"></div>' . "\n";
                            }
                            $content .= '</div><!-- end .col_wraper -->' . "\n";
                            $content .= wip_pagenavi('', false, '<div class="pagination_wrap">', '</div>');
                        } else {
                            $content .= __('No Posts Found!', 'wip');
                        }
                        wp_reset_postdata();
                        break;
                }
            } else {
                /** if content use sidebar */
                switch ($layout_type) {
                    case 'default':
                    case 'default-fullwidth':
                        if (have_posts()) {
                            while (have_posts()) {
                                the_post();
                                global $post;
                                $ccat = get_the_category();
                                $ct = '';
                                foreach ($ccat as $a => $cct) {
                                    if ($a != 0) {
                                        $ct .= ', ';
                                    }
                                    $ct .= '<a href="' . get_category_link($cct->term_id) . '">' . $cct->cat_name . '</a>';
                                }
                                $num_comments = get_comments_number();
                                $write_comments = "";
                                if (comments_open()) {
                                    if ($num_comments == 0) {
                                        $comments = __('0 Comments', 'wip');
                                    } elseif ($num_comments > 1) {
                                        $comments = $num_comments . __(' Comments', 'wip');
                                    } else {
                                        $comments = __('1 Comment', 'wip');
                                    }
                                    $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
                                } else {
                                    $write_comments = __('Comment Off', 'wip');
                                }
                                $content .= '<div class="standard-blog-lists">' . "\n";
                                /** post with thumbnail */
                                if (has_post_thumbnail() && wip_get_attached_file($post->ID)) {
                                    $content .= '<div class="standard-blog-thumbnail">' . "\n";
                                    $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n";
                                    $content .= '<img src="' . wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 700, 260) . '" alt="' . the_title_attribute('echo=0') . '"/>';
                                    $content .= '</a>' . "\n";
                                    $content .= '</div>' . "\n";
                                }
                                $content .= '<div class="standard-blog-excerpt">' . "\n";
                                $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . get_the_title() . '</a></h3>' . "\n";
                                $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . __('Continue Reading', 'wip') . ' &rarr;</a>' . "\n";
                                $content .= '</div>' . "\n";
                                $content .= '</div>' . "\n";
                            }
                            $content .= wip_pagenavi('', false);
                        } else {
                            $content .= __('No Posts Found!', 'wip');
                        }
                        wp_reset_postdata();
                        break;
                    case 'column':
                        if (have_posts()) {
                            $content .= '<div class="col_wraper no_margin">' . "\n";
                            $intloop = 0;
                            while (have_posts()) {
                                the_post();
                                $intloop++;
                                global $post;
                                $colClass = 'col_four';
                                $colImage = "";
                                switch ($column) {
                                    case '4':
                                        $colClass = 'col_four';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 160, 104) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                    case '3':
                                        $colClass = 'col_three';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 220, 126) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                    case '2':
                                        $colClass = 'col_two';
                                        $colImage = has_post_thumbnail() && wip_get_attached_file($post->ID) ? wip_print_autoresize(wip_get_attached_file($post->ID), get_thumbOri($post->ID, 'full'), 340, 192) : get_template_directory_uri() . '/images/no-preview.jpg';
                                        break;
                                }
                                $ccat = get_the_category();
                                $ct = '';
                                foreach ($ccat as $a => $cct) {
                                    if ($a != 0) {
                                        $ct .= ', ';
                                    }
                                    $ct .= '<a href="' . get_category_link($cct->term_id) . '">' . $cct->cat_name . '</a>';
                                }
                                $num_comments = get_comments_number();
                                $write_comments = "";
                                if (comments_open()) {
                                    if ($num_comments == 0) {
                                        $comments = __('0 Comments', 'wip');
                                    } elseif ($num_comments > 1) {
                                        $comments = $num_comments . __(' Comments', 'wip');
                                    } else {
                                        $comments = __('1 Comment', 'wip');
                                    }
                                    $write_comments = '<a href="' . get_comments_link($post->ID) . '">' . $comments . '</a>';
                                } else {
                                    $write_comments = __('Comment Off', 'wip');
                                }
                                $specialStyle = "";
                                if ($intloop == 1 || $intloop % $column == 1) {
                                    $specialStyle = " no_margin_left";
                                }
                                if ($intloop % $column == 0) {
                                    $specialStyle = " no_margin_right";
                                }
                                $blogtitle = get_the_title();
                                if ($column == '4') {
                                    $blogtitle = limit_text(get_the_title(), 25);
                                }
                                $content .= '<div class="column-blog-lists ' . $colClass . ' float_left' . $specialStyle . '">' . "\n";
                                $content .= '<div class="column-blog-thumbnail">' . "\n";
                                $content .= '<a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . "\n";
                                $content .= '<img src="' . $colImage . '" alt="' . the_title_attribute('echo=0') . '"/>';
                                $content .= '</a>' . "\n";
                                $content .= '</div>' . "\n";
                                $content .= '<h3 class="blog-list-title"><a href="' . get_permalink($post->ID) . '" title="' . sprintf(__('Permanent Link to %s', 'wip'), the_title_attribute('echo=0')) . '">' . $blogtitle . '</a></h3>' . "\n";
                                if ($column == '4' || $column == '3') {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '</span>' . "\n";
                                } else {
                                    $content .= '<span class="meta-blog-lists">
												' . __('By', 'wip') . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>
												&ndash;
												' . __('On', 'wip') . ' ' . sprintf(__('%1$s', 'wip'), get_the_time('F d, Y', $post->ID)) . '
												&ndash;
												' . __('In', 'wip') . ' ' . $ct . '
												' . __('With', 'wip') . ' ' . $write_comments . '
												</span>' . "\n";
                                }
                                if ($column != '4') {
                                    if ($column == '2') {
                                        $content .= wpautop(str_replace('[...]', '...', get_the_excerpt()));
                                    } else {
                                        $content .= wpautop(limit_text(get_the_excerpt(), 120, '...'));
                                    }
                                }
                                $content .= '</div>' . "\n";
                                if ($intloop % $column == 0) {
                                    $content .= '<div class="clear"></div>' . "\n";
                                }
                            }
                            if ($intloop % $column != 0) {
                                $content .= '<div class="clear"></div>' . "\n";
                            }
                            $content .= '</div><!-- end .col_wraper -->' . "\n";
                            $content .= wip_pagenavi('', false, '<div class="pagination_wrap">', '</div>');
                        } else {
                            $content .= __('No Posts Found!', 'wip');
                        }
                        wp_reset_postdata();
                        break;
                }
            }
            return $content;
        }
示例#2
0
        ?>
"><?php 
        print __('Read More', 'wip');
        ?>
 ></a>
					</div>
							
				</div>


			<?php 
    }
    ?>

			<?php 
    wip_pagenavi();
    ?>

		<?php 
} else {
    ?>

			<p class="search-fail"><?php 
    _e('Sorry, but nothing matched with your search criteria. Please try again with some different keywords.', 'wip');
    ?>
</p>

		<?php 
}
wp_reset_query();
?>
 /**
  * Call product lists, use this on homepage manager and page content manager
  * @uses global $woocommerce_loop
  */
 function _wip_show_product_lists_for_manager($col = 4, $postNumber = 4, $catID = 0, $featured = false, $pagination = false)
 {
     global $woocommerce_loop, $sidebar_layout, $fullwidth_layout;
     wp_reset_query();
     $content = "";
     $woocol = $col;
     $toocol = $col;
     if ($col == 34) {
         $woocol = 3;
         $toocol = 4;
     }
     $woocommerce_loop['columns'] = $woocol;
     $paged = $pagination ? get_query_var('paged') ? get_query_var('paged') : 1 : false;
     $parentLayout = $fullwidth_layout ? 'fullwidth' : 'content-sidebar';
     $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $postNumber, 'paged' => $paged);
     $args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
     if (!$featured && ($catID && $catID != "" && $catID !== 0)) {
         $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => intval($catID), 'operator' => 'IN'));
     }
     if ($featured) {
         $args['meta_key'] = '_featured';
         $args['meta_value'] = 'yes';
     }
     $colClass = 'col_four float_left';
     switch ($col) {
         case '5':
             $colClass = 'col_five float_left';
             break;
         case '4':
         case '34':
             $colClass = 'col_four float_left';
             break;
         case '3':
             $colClass = 'col_three float_left';
             break;
         case '2':
             $colClass = 'col_two float_left';
             break;
     }
     #sent new variable via $woocommerce_loop
     $woocommerce_loop['wip_cols'] = $toocol;
     $woocommerce_loop['parent_layout'] = $parentLayout;
     //$product_query = new WP_Query( $args );
     query_posts($args);
     ob_start();
     woocommerce_get_template_part('loop', 'shop');
     $woo_loop = ob_get_clean();
     $woo_loop = str_replace('class="product ', 'class="' . $colClass . ' ', $woo_loop);
     $content .= '<div class="product_wraper">' . "\n";
     $content .= '<div class="col_wraper no_margin">' . "\n";
     $content .= $woo_loop;
     $content .= $pagination ? wip_pagenavi($args, false, '<div class="pagination_wrap">', '</div>') : '';
     $content .= '</div>' . "\n";
     $content .= '</div>' . "\n";
     wp_reset_query();
     return $content;
 }