Пример #1
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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 /**
  * 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;
 }
Пример #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;
 }
Пример #5
0
 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;
 }
Пример #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;
 }
Пример #7
0
 /**
  * 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 
        echo twoot_generator('load_template', 'loop-archive');
Пример #9
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 
        }
Пример #10
0
 /**
  * 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;
 }