コード例 #1
0
 /**
  * Post
  * @since     1.0
  * @updated   1.0
  *
  */
 public function post()
 {
     extract($this->atts);
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'taxonomy' => $taxonomy));
     $do_query = new WP_Query($query->do_related_query());
     $this->entries = $do_query;
     // Check if it has posts
     if (empty($this->entries) || empty($this->entries->posts)) {
         return;
     }
     // Output HTML
     $html = '<div class="related-posts pt mt">';
     $html .= '<h5 class="sub-title">' . $title . '</h5>';
     $html .= '<div class="outer">';
     $html .= '<ul class="clearfix">';
     while ($this->entries->have_posts()) {
         $this->entries->the_post();
         $html .= '<li class="item column six">';
         $html .= '<div class="inner clearfix">';
         $html .= twoot_generator('load_template', 'loop-related-posts');
         $html .= '</div>';
         $html .= '</li>';
     }
     wp_reset_query();
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
コード例 #2
0
ファイル: related.php プロジェクト: sniezekjp/prod-fs
 * Related Products
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
?>

<?php 
// Get Query
$query = new Twoot_Query(array('counts' => 16, 'order' => 'DESC', 'orderby' => 'date', 'post_type' => 'product', 'taxonomy' => 'product_cat'));
$products = new WP_Query($query->do_related_query());
?>

<?php 
if ($products->have_posts()) {
    ?>

<div class="related-products the-carousel-list">

	<h5 class="carousel-title"><?php 
    _e('Related Products', 'Twoot');
    ?>
</h5>

	<ul id="related-product-carousel" class="products products-carousel clearfix">