function mom_category_content($cols = 2) { $cols = 'grid-col-' . $cols; $cat_data = get_option("category_" . get_query_var('cat')); $cat_layout = isset($cat_data['layout']) ? $cat_data['layout'] : ''; $cat_layout_style = isset($cat_data['layout_style']) ? $cat_data['layout_style'] : ''; $dateformat = mom_option('date_format'); $ad_id = mom_option('cat_ad_id'); $ad_count = mom_option('cat_ad_count'); $ad_repeat = mom_option('cat_ad_repeat'); $post_head = ''; $post_meta_hp = mom_option('post_meta_hp'); if ($post_meta_hp == 1) { $post_head = mom_option('post_head'); $post_head_author = mom_option('post_head_author'); $post_head_date = mom_option('post_head_date'); $post_head_cat = mom_option('post_head_cat'); $post_head_commetns = mom_option('post_head_commetns'); $post_head_views = mom_option('post_head_views'); } else { $post_head = 1; $post_head_author = 1; $post_head_date = 1; $post_head_cat = 1; $post_head_commetns = 1; $post_head_views = 1; } if (mom_option('cat_posts_layout') == 'blog' || $cat_layout == 'blog') { $style = ''; if (mom_option('cat_posts_layout_style') == 'large' || $cat_layout_style == 'large') { $style = 'large'; } else { $style = ''; } $nexcerpt = ''; $class = ''; ?> <div class="blog_posts"> <?php $post_count = 1; if (have_posts()) { while (have_posts()) { the_post(); ?> <?php mom_blog_post($style, $nexcerpt, $class); if ($ad_id != '') { if ($ad_repeat == 1) { if ($post_count % $ad_count == 0) { echo do_shortcode('[ad id="' . $ad_id . '"]'); } } else { if ($post_count == $ad_count) { echo do_shortcode('[ad id="' . $ad_id . '"]'); } } } $post_count++; ?> <?php } } else { ?> <!-- Else in here --> <?php } ?> <?php mom_pagination(); ?> </div> <?php } else { ?> <div class="site-content page-wrap"> <?php if (mom_option('cat_swi')) { ?> <div class="f-tabbed-head"> <ul class="f-tabbed-sort cat-sort"> <li class="grid active"><a href="#"><span class="brankic-icon-grid"></span><?php _e(' Grid', 'framework'); ?> </a></li> <li class="list"><a href="#"><span class="brankic-icon-list2"></span><?php _e(' List', 'framework'); ?> </a></li> </ul> </div> <?php } ?> <?php $catswi = mom_option('cat_swi_def'); $swiclass = 'cat-grid ' . $cols; if ($catswi == 'list') { $swiclass = 'cat-list'; } $srclass = ''; if (mom_option('cat_swi') != true) { $srclass = ' no-head'; } ?> <div class="cat-body<?php echo $srclass; ?> "> <ul class="nb1 <?php echo $swiclass; ?> clearfix"> <?php $post_count = 1; if (have_posts()) { while (have_posts()) { the_post(); ?> <li <?php post_class(); ?> itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name" class="cat-list-title"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($post_head != 0) { ?> <div class="cat-list-meta entry-meta"> <?php if ($post_head_author != 0) { ?> <div class="author-link"> <?php _e('Posted by', 'framework'); ?> <a itemprop="author" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> " rel="author"><?php echo get_the_author(); ?> </a> </div> <?php } ?> <?php if ($post_head_date != 0) { ?> <span>|</span><time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php _e('Date: ', 'framework'); the_time($dateformat); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <span>|</span><a href="<?php the_permalink(); ?> "> <?php comments_number(__('0 comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> <?php if ($post_head_views != 0) { ?> <div class="post-views"> <span>|</span><?php echo getPostViews(get_the_ID()); ?> </div> <?php } ?> </div> <?php } ?> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb1-thumb'); ?> <span class="post-format-icon"></span> </a></figure> <?php } ?> <h2 itemprop="name" class="cat-grid-title"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content cat-grid-meta"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 105); ?> ... </p> </div> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <div class="entry-content cat-list-meta"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 200); ?> ... </p> </div> <?php if ($post_head != 0) { ?> <div class="cat-grid-meta entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php the_time($dateformat); ?> </time> <?php } ?> <?php if ($post_head_author != 0) { ?> <div class="author-link"> |<?php _e(' by ', 'framework'); ?> <a itemprop="author" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> " rel="author"><?php echo get_the_author(); ?> </a> </div> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> |<a href="<?php the_permalink(); ?> "> <?php comments_number(__('0 comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> <?php if (is_rtl()) { ?> <a class="read-more" href="<?php the_permalink(); ?> "><?php _e('Read more', 'framework'); ?> <i class="fa-icon-angle-double-left"></i></a> <?php } else { ?> <a class="read-more" href="<?php the_permalink(); ?> "><?php _e('Read more', 'framework'); ?> <i class="fa-icon-angle-double-right"></i></a> <?php } ?> </div> </li> <?php if ($ad_id != '') { if ($ad_repeat == 1) { if ($post_count % $ad_count == 0) { echo '<li>'; echo do_shortcode('[ad id="' . $ad_id . '"]'); echo '</li>'; } } else { if ($post_count == $ad_count) { echo '<li>'; echo do_shortcode('[ad id="' . $ad_id . '"]'); echo '</li>'; } } } $post_count++; } } else { ?> <!-- Else in here --> <?php } ?> </ul> <?php mom_pagination(); ?> </div> </div> <?php } }
function mom_blog_sc($atts, $content) { extract(shortcode_atts(array('style' => '', 'display' => '', 'category' => '', 'tag' => '', 'specific' => '', 'orderby' => '', 'posts_per_page' => 9, 'offset' => '', 'nexcerpt' => '', 'pagination' => 'yes', 'class' => '', 'cols' => 2, 'post_type' => '', 'ad_id' => '', 'ad_count' => 3, 'ad_repeat' => ''), $atts)); $cols = 'grid-col-' . $cols; static $id = 75; $id++; if ($category == 'Select a Category') { $category = ''; } if ($tag == 'Select a Tag') { $tag = ''; } if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } global $post; $exclude_posts = array($post->ID); //$output = get_transient('mom_blog_sc_'.$id.$style.$display.$category.$tag.$specific.$orderby.$offset.$nexcerpt.$posts_per_page.$pagination.$paged); $output = false; if ($orderby == 'rand') { $output = false; } if ($output == false) { ob_start(); ?> <?php if ($style == 'grid') { ?> <div class="site-content page-wrap category-view-blog"> <?php if (mom_option('cat_swi')) { ?> <div class="f-tabbed-head"> <ul class="f-tabbed-sort cat-sort"> <li class="grid active"><a href="#"><span class="brankic-icon-grid"></span><?php _e(' Grid', 'framework'); ?> </a></li> <li class="list"><a href="#"><span class="brankic-icon-list2"></span><?php _e(' List', 'framework'); ?> </a></li> </ul> </div> <?php } ?> <?php $catswi = mom_option('cat_swi_def'); $swiclass = 'cat-grid ' . $cols; if ($catswi == 'list') { $swiclass = 'cat-list'; } $srclass = ''; if (mom_option('cat_swi') != true) { $srclass = ' no-head'; } ?> <div class="cat-body<?php echo $srclass; ?> "> <ul class="nb1 <?php echo $swiclass; ?> clearfix"> <?php } else { ?> <div class="blog_posts"> <?php } ?> <?php if ($display == 'category') { $args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'cat' => $category, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false); } elseif ($display == 'tag') { $args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'tag' => $tag, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false); } elseif ($display == 'specific') { $args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'p' => $specific, 'orderby' => $orderby, 'cache_results' => false); } else { $args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false); } $post_count = 1; $query = new WP_Query($args); update_post_thumbnail_cache($query); ?> <?php if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <?php $grid_class = ''; if ($style == 'grid') { if ($post_count % 2 == 0) { $grid_class = ' second'; } else { $grid_class = ' first'; } } mom_blog_post($style, $nexcerpt, $class . $grid_class); if ($ad_id != '') { if ($ad_repeat == 'yes') { if ($post_count % $ad_count == 0) { if ($style == 'grid') { echo '<li>'; } echo do_shortcode('[ad id="' . $ad_id . '"]'); if ($style == 'grid') { echo '</li>'; } } } else { if ($post_count == $ad_count) { if ($style == 'grid') { echo '<li>'; } echo do_shortcode('[ad id="' . $ad_id . '"]'); if ($style == 'grid') { echo '</li>'; } } } } $post_count++; ?> <?php } } else { ?> <p><?php _e('Sorry, no posts matched your criteria.', 'framework'); ?> </p> <?php } ?> <?php if ($pagination != 'no') { ?> <?php if ($style != 'grid') { mom_pagination($query->max_num_pages); } ?> <?php } ?> <?php wp_reset_query(); ?> <?php if ($style == 'grid') { ?> </ul> <?php if ($pagination != 'no') { mom_pagination($query->max_num_pages); } ?> </div> </div> <?php } else { ?> </div> <!-- blog posts --> <?php } $output = ob_get_contents(); ob_end_clean(); //set_transient('mom_blog_sc_'.$id.$style.$display.$category.$tag.$specific.$orderby.$offset.$nexcerpt.$posts_per_page.$pagination.$paged, $output, 60*60*24); } return $output; }
?> </a> </div> <?php } ?> </div> <?php } ?> </div> </li> <?php } echo '</ul>'; mom_pagination($query->max_num_pages); } else { ?> <p><?php _e('Sorry, no posts matched your criteria.', 'framework'); ?> </p> <?php } ?> <?php wp_reset_postdata(); ?> </div> </div><!--Full width Main Content-->
} ?> </div> </li> <?php } } else { ?> <!-- Else in here --> <?php } ?> </ul> <?php mom_pagination(); ?> </div> </div> </div><!--Main Content--> <?php get_sidebar('left'); ?> </div><!--Main left--> <?php get_sidebar(); ?>
function mom_woo_pagination() { mom_pagination(); }