/**
  * Full Blog
  * @since     1.0
  * @updated   1.0
  *
  */
 public function full_blog()
 {
     extract($this->atts);
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'taxonomy' => $taxonomy));
     $do_query = new WP_Query($query->do_template_query());
     $this->entries = $do_query;
     // Check if it has posts
     if (empty($this->entries) || empty($this->entries->posts)) {
         return $html = '<div class="the-not-posts">' . esc_attr__('Sorry, there is no posts in the current categories, please add some items in the dashboard!', 'Twoot') . '</div>';
     }
     // Output HTML
     $html = '<div class="post-full-blog">';
     $html .= '<ul class="the-blog-list full-blog">';
     while ($this->entries->have_posts()) {
         $this->entries->the_post();
         $html .= '<li class="post-item">';
         $html .= twoot_generator('load_template', 'loop-blog-full');
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</div>';
     wp_reset_query();
     $html .= twoot_generator('pagination', $this->entries);
     return $html;
 }
Exemple #2
0
 function shortcode_faqs($atts, $content = null)
 {
     extract($atts = shortcode_atts(array('counts' => '12', 'cats' => '', 'posts' => '', 'order' => 'DESC', 'orderby' => 'date', 'filter' => 'yes', 'post_type' => 'faq', 'taxonomy' => 'faq_cat'), $atts));
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'taxonomy' => $taxonomy));
     $grid = new Twoot_Template_Grid();
     $do_query = new WP_Query($query->do_template_query());
     $faqs_class = $filter == 'yes' ? 'column nine' : 'twelve';
     $html = '<div class="the-faq-list shortcode-toggle outer clearfix">' . "\n";
     if ($filter == 'yes') {
         $html .= '<div class="column three">';
         $html .= $grid->filter_terms_menu($do_query->posts, $atts);
         $html .= '</div>';
     }
     $html .= '<div id="faqs" class="' . $faqs_class . '">';
     while ($do_query->have_posts()) {
         $do_query->the_post();
         //Get terms class
         $terms_class = $grid->filter_terms_class(get_the_ID(), $atts);
         $html .= '<div class="tog-item faq-item inner ' . $terms_class . '">';
         $html .= '<a href="#" class="tog"><i class="icon twoot-icon"></i>' . get_the_title() . '</a>';
         $html .= '<div class="tog-content clearfix">' . do_shortcode(get_the_content()) . '</div>';
         $html .= '</div>';
     }
     wp_reset_query();
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
 function shortcode_product_carousel($atts, $content = null)
 {
     extract(shortcode_atts(array('title' => 'Recent Products', 'type' => 'product_cat', 'counts' => '16', 'cats' => '', 'posts' => '', 'order' => 'DESC', 'orderby' => 'date', 'auto' => 'false', 'speed' => '800', 'pause' => '5000', 'move_slides' => '4'), $atts));
     global $woocommerce;
     $id = twoot_get_frontend_func('rand_num', 5);
     if (!in_array($type, array('product_cat', 'product_tag'), true)) {
         return $html = '<div class="the-not-posts">' . esc_attr__('Hi, please check the type option, the current type is not match!', 'Twoot_Toolkit') . '</div>';
     }
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => 'product', 'taxonomy' => $type));
     $products = new WP_Query($query->do_template_query());
     if ($products->have_posts()) {
         $html = '<div class="the-carousel-list the-product-list">';
         $html .= '<h5 class="carousel-title">' . $title . '</h5>';
         $html .= '<ul id="post-carousel-' . $id . '" class="products clearfix">';
         while ($products->have_posts()) {
             $products->the_post();
             $html .= twoot_generator('load_template', 'loop-product-carousel');
         }
         wp_reset_query();
         $html .= '</ul>';
         $html .= '</div>';
         $html .= twoot_generator('carousel_script', $id, $auto, $speed, $pause, $move_slides, $tag = 'd');
     } else {
         $html = '<div class="the-not-posts">' . esc_attr__('Hi, please check the type option, the current type is not match!', 'Twoot_Toolkit') . '</div>';
     }
     return $html;
 }
Exemple #4
0
 function shortcode_latest_blog($atts, $content = null)
 {
     extract(shortcode_atts(array('title' => 'Latest Blog', 'top_counts' => '1', 'last_counts' => '3', 'cats' => '', 'posts' => ''), $atts));
     global $post;
     // Get Query
     $top_query = new Twoot_Query(array('counts' => $top_counts, 'cats' => $cats, 'posts' => $posts, 'order' => 'DESC', 'orderby' => 'date', 'post_type' => 'post', 'taxonomy' => 'category'));
     $last_query = new Twoot_Query(array('counts' => $last_counts + 1, 'cats' => $cats, 'posts' => $posts, 'order' => 'DESC', 'orderby' => 'date', 'post_type' => 'post', 'taxonomy' => 'category'));
     $do_top_query = new WP_Query($top_query->do_template_query());
     $do_last_query = new WP_Query($last_query->do_template_query());
     $count = 0;
     $html = '<div class="shortcode-latest-blog">';
     $html .= '<h5 class="sub-title">' . $title . '</h5>';
     $html .= '<div class="outer clearfix">';
     $html .= '<div class="the-top-loop column six">';
     $html .= '<div class="inner">';
     $html .= '<ul>';
     while ($do_top_query->have_posts()) {
         $do_top_query->the_post();
         $do_not_duplicate[] = $post->ID;
         $html .= '<li class="post-item clearfix">';
         $html .= twoot_generator('load_template', 'loop-top-latest-blog');
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '</div>';
     wp_reset_query();
     $html .= '<div class="the-last-loop column six">';
     $html .= '<div class="inner">';
     $html .= '<ul>';
     while ($do_last_query->have_posts()) {
         $do_last_query->the_post();
         if (in_array($post->ID, $do_not_duplicate)) {
             continue;
         }
         // Num class
         $count++;
         $num_class = $do_last_query->post_count % $count == 0 ? 'odd' : 'even';
         $html .= '<li class="post-item ' . $num_class . ' clearfix">';
         $html .= twoot_generator('load_template', 'loop-last-latest-blog');
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '</div>';
     wp_reset_query();
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
 function shortcode_testimonial_carousel($atts, $content = null)
 {
     extract(shortcode_atts(array('counts' => '12', 'posts' => '', 'order' => 'DESC', 'orderby' => 'date', 'auto' => 'true', 'speed' => '800', 'pause' => '5000', 'mode' => 'fade'), $atts));
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => '', 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => 'testimonial', 'taxonomy' => ''));
     $do_query = new WP_Query($query->do_template_query());
     $html = '<div class="shortcode-testimonials shortcode-testimonial-carousel">';
     $html .= '<ul class="testimonial-carousel" data-auto="' . $auto . '" data-speed="' . $speed . '" data-pause="' . $pause . '" data-mode="' . $mode . '">';
     while ($do_query->have_posts()) {
         $do_query->the_post();
         $html .= '<li class="testimonial-item clearfix">';
         $html .= twoot_generator('load_template', 'loop-testimonial');
         $html .= '</li>';
     }
     wp_reset_postdata();
     $html .= '</ul>';
     $html .= '</div>';
     return $html;
 }
Exemple #6
0
 function shortcode_testimonials($atts, $content = null)
 {
     extract(shortcode_atts(array('counts' => '5', 'posts' => '', 'order' => 'DESC', 'orderby' => 'date'), $atts));
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => '', 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => 'testimonial', 'taxonomy' => ''));
     $do_query = new WP_Query($query->do_template_query());
     $html = '<div class="shortcode-testimonials">';
     $html .= '<ul>';
     while ($do_query->have_posts()) {
         $do_query->the_post();
         $html .= '<li class="testimonial-item clearfix">';
         $html .= twoot_generator('load_template', 'loop-testimonial');
         $html .= '</li>';
     }
     wp_reset_postdata();
     $html .= '</ul>';
     $html .= '</div>';
     return $html;
 }
 /**
  * Carousel
  * @since     1.0
  * @updated   1.0
  *
  */
 public function carousel()
 {
     extract($this->atts);
     $loop = $post_type == 'portfolio' ? 'portfolio' : 'blog';
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'taxonomy' => $taxonomy));
     $do_query = new WP_Query($query->do_template_query());
     $this->entries = $do_query;
     // Check if it has posts
     if (empty($this->entries) || empty($this->entries->posts)) {
         return;
     }
     // Output HTML
     $html = '';
     while ($this->entries->have_posts()) {
         $this->entries->the_post();
         $html .= '<li class="post-item column">';
         $html .= twoot_generator('load_template', 'loop-' . $loop . '-carousel');
         $html .= '</li>';
     }
     wp_reset_query();
     return $html;
 }
    <?php 
$args = array('hide_empty' => false, 'hierarchical' => true, 'parent' => 0);
$terms = get_terms('season', $args);
foreach ($terms as $term) {
    $child_args = array('child_of' => $term->ID);
    $child = get_terms('season', $child_args);
    echo '<h3>' . $term->name . '</h3>';
    foreach ($child as $child_term) {
        echo '<p>' . $child_term->name . '</p>';
    }
}
?>
	<?php 
// Query
$query = new Twoot_Query(array('counts' => 15, 'order' => 'DESC', 'orderby' => 'date', 'post_type' => 'team', 'taxonomy' => 'season'));
$do_query = new WP_Query($query->do_template_query());
?>

	<?php 
if ($do_query || $do_query->posts) {
    ?>

		<div class="post-archive">
			<ul>
			<?php 
    while ($do_query->have_posts()) {
        $do_query->the_post();
        ?>
				<li class="post-item clearfix">
				<?php 
 /**
  * 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;
 }
Exemple #10
0
        break;
    case '3':
        $types = array('post');
        break;
    case '4':
        $types = array('page');
        break;
    case '5':
        $types = array('portfolio');
        break;
    case '6':
        $types = array('product');
        break;
}
// Get Query
$query = new Twoot_Query(array('counts' => 10, 'post_type' => $types));
$do_query = new WP_Query($query->do_global_query());
?>

	<?php 
if ($do_query || $do_query->posts) {
    ?>

		<div class="post-search">
			<ul>
			<?php 
    while ($do_query->have_posts()) {
        $do_query->the_post();
        ?>
				<li class="post-item">
				<?php 
Exemple #11
0
        function widget($args, $instance)
        {
            extract($args, EXTR_SKIP);
            global $post;
            $title = apply_filters('widget_title', $instance['title']);
            $counts = $instance['counts'];
            $cats = $instance['cats'];
            $posts = $instance['posts'];
            $orderby = $instance['orderby'];
            $order = $instance['order'];
            // Get Query
            $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => 'post', 'taxonomy' => 'category'));
            $do_query = new WP_Query($query->do_template_query());
            ?>
		<?php 
            echo $before_widget;
            ?>
		<?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
			<ul>
				<?php 
            while ($do_query->have_posts()) {
                $do_query->the_post();
                ?>
				<li class="clearfix<?php 
                if (!has_post_thumbnail()) {
                    echo ' has-not-thumbnail';
                }
                ?>
">
				<?php 
                if (has_post_thumbnail()) {
                    ?>
				<figure class="featured-image img-preload img-hover post-image">
					<a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo get_the_post_thumbnail($post->ID, 'thumbnail');
                    ?>
					<div class="overlay"></div>
					</a>
				</figure>
				<?php 
                }
                ?>
				<section class="post-entry">
				<div class="title"><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                printf(esc_attr__('Permalink to %s', 'Twoot_Toolkit'), the_title_attribute('echo=0'));
                ?>
"><?php 
                the_title();
                ?>
</a></div>
				<div class="date"><?php 
                echo get_the_time(get_option('date_format'));
                ?>
</div>
				</section>
				</li>
				<?php 
            }
            wp_reset_postdata();
            ?>
			</ul>
		<?php 
            echo $after_widget;
            ?>
		<?php 
        }
 /**
  * Left Grid
  * @since     1.0
  * @updated   1.0
  *
  */
 public function left_grid()
 {
     extract($this->atts);
     // Loop
     switch ($post_type) {
         case 'portfolio':
             $loop = 'portfolio';
             break;
         case 'post':
             $loop = 'blog';
             break;
         case 'product':
             $loop = 'product';
             break;
     }
     // Check if the woo has actived
     if (!twoot_get_checked_func('woo_activated') && $post_type == 'product') {
         return $html = '<div class="the-not-posts">' . esc_attr__('Hi, please make sure that you have installed the plugin:woocommerce.', 'Twoot') . '</div>';
     }
     // ul & li class
     $ul_class = $post_type == 'product' ? ' products outer' : '';
     $li_class = $post_type == 'product' ? 'item product-item' : 'item';
     // Get Query
     $query = new Twoot_Query(array('counts' => $counts, 'cats' => $cats, 'posts' => $posts, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'taxonomy' => $taxonomy));
     $do_query = is_page() || is_singular() ? new WP_Query($query->do_template_query()) : new WP_Query($query->do_global_query());
     $this->entries = $do_query;
     // Check if it has posts
     if (empty($this->entries) || empty($this->entries->posts)) {
         return $html = '<div class="the-not-posts">' . esc_attr__('Sorry, there is no posts in the current categories, please add some items in the dashboard!', 'Twoot') . '</div>';
     }
     // Check if it's 4 columns
     if ($columns == 4) {
         return $html = '<div class="the-not-posts">' . esc_attr__('Sorry, the left grid layout do not support the 4 columns.', 'Twoot') . '</div>';
     }
     // Set the columns
     switch ($columns) {
         case 2:
             $grid = 'six';
             break;
         case 3:
             $grid = 'four';
             break;
     }
     // Output HTML
     $html = '<div class="the-grid-list left-grid outer clearfix">';
     $html .= '<div class="column three">' . $this->filter_terms_menu($this->entries->posts, $this->atts) . '</div>';
     $html .= '<div class="column nine">';
     $html .= '<ul class="filter-items clearfix' . $ul_class . '">';
     while ($this->entries->have_posts()) {
         $this->entries->the_post();
         //Get terms class
         $terms_class = $this->filter_terms_class(get_the_ID(), $this->atts);
         $html .= '<li class="' . $li_class . ' column ' . $grid . ' ' . $terms_class . '">';
         $html .= '<div class="inner">';
         $html .= twoot_generator('load_template', 'loop-' . $loop . '-grid');
         $html .= '</div>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '</div>';
     wp_reset_query();
     $html .= $paging == 'yes' ? twoot_generator('pagination', $this->entries) : '';
     return $html;
 }
 function page_title($type)
 {
     switch ($type) {
         case 'page':
             if (!is_front_page() && twoot_get_frontend_func('meta', 'show_page_header') == true) {
                 $class = twoot_get_frontend_func('meta', 'show_line') == true ? ' has-line' : '';
                 $title = twoot_get_frontend_func('meta', 'page_title') ? twoot_get_frontend_func('meta', 'page_title') : get_the_title();
                 $desc = twoot_get_frontend_func('meta', 'page_desc');
                 $html = '<header class="site-page-header' . $class . ' clearfix">';
                 $html .= '<div class="entry-page-header">';
                 $html .= '<h1 class="entry-title">' . $title . '</h1>';
                 if ($desc) {
                     $html .= '<div class="entry-desc">' . stripslashes($desc) . '</div>';
                 }
                 $html .= '</div>';
                 $html .= '</header>';
                 return $html;
             }
             break;
         case 'archive':
             $desc = '';
             if (is_category()) {
                 $args = array('<p>', '</p>');
                 $title = single_cat_title('', false);
                 $desc = str_replace($args, '', term_description());
             } elseif (is_day()) {
                 $title = esc_attr__('Archive for date:', 'Twoot') . " " . get_the_time('F jS, Y');
             } elseif (is_month()) {
                 $title = esc_attr__('Archive for month:', 'Twoot') . " " . get_the_time('F, Y');
             } elseif (is_year()) {
                 $title = esc_attr__('Archive for year:', 'Twoot') . " " . get_the_time('Y');
             } elseif (is_search()) {
                 switch (twoot_get_frontend_func('opt', 'opt', 'search_type')) {
                     case '1':
                         $types = array('post', 'page', 'portfolio', 'product');
                         break;
                     case '2':
                         $types = array('post', 'page');
                         break;
                     case '3':
                         $types = array('post');
                         break;
                     case '4':
                         $types = array('page');
                         break;
                     case '5':
                         $types = array('portfolio');
                         break;
                     case '6':
                         $types = array('product');
                         break;
                 }
                 // Get Query
                 $query = new Twoot_Query(array('post_type' => $types));
                 $do_query = new WP_Query($query->do_global_query());
                 if (!empty($do_query->found_posts)) {
                     if ($do_query->found_posts > 1) {
                         $title = $do_query->found_posts . " " . esc_attr__('search results for:', 'Twoot') . " " . esc_attr__(get_search_query());
                     } else {
                         $title = $do_query->found_posts . " " . esc_attr__('search result for:', 'Twoot') . " " . esc_attr__(get_search_query());
                     }
                 } else {
                     if (!empty($_GET['s'])) {
                         $title = esc_attr__('Search results for:', 'Twoot') . " " . esc_attr__(get_search_query());
                     } else {
                         $title = esc_attr__('To search the site please enter a valid term', 'Twoot');
                     }
                 }
             } elseif (is_author()) {
                 $curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
                 $title = esc_attr__('Author Archive', 'Twoot') . " ";
                 if (isset($curauth->nickname)) {
                     $title .= esc_attr__('for:', 'Twoot') . " " . $curauth->nickname;
                 }
             } elseif (is_tag()) {
                 $title = esc_attr__('Tag Archive for:', 'Twoot') . " " . single_tag_title('', false);
             } elseif (is_tax()) {
                 $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
                 $title = $term->name;
                 $args = array('<p>', '</p>');
                 $desc = str_replace($args, '', term_description());
             } else {
                 $title = esc_attr__('Archives', 'Twoot') . " ";
             }
             if (isset($_GET['paged']) && !empty($_GET['paged'])) {
                 $title .= " (" . esc_attr__('Page', 'Twoot') . " " . $_GET['paged'] . ")";
             }
             $html = '<header class="site-page-header has-line clearfix">';
             $html .= '<div class="entry-page-header">';
             $html .= '<h1 class="entry-title">' . $title . '</h1>';
             if ($desc) {
                 $html .= '<div class="entry-desc">' . stripslashes($desc) . '</div>';
             }
             $html .= '</div>';
             $html .= '</header>';
             return $html;
             break;
     }
 }
Exemple #14
0
/**
 * 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">