/** * 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; }
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 echo twoot_generator('load_template', 'loop-search');
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; } }