function mom_news_boxes($atts, $content = null) { global $unique_posts; global $do_unique_posts; extract(shortcode_atts(array('style' => 'nb1', 'title' => '', 'display' => '', 'cat' => '', 'tag' => '', 'number_of_posts' => '4', 'orderby' => '', 'order' => '', 'nb_excerpt' => '', 'sub_categories' => 'no', 'show_more' => 'yes', 'show_more_event' => '', 'post_type' => '', 'exclude_posts' => '', 'class' => ''), $atts)); global $post; $exclude_posts = array($post->ID); $ajax_class = ''; if ($show_more_event == 'ajax') { $ajax_class = 'show_more_ajax'; } if ($style == 'nb6' && $number_of_posts == '4') { $number_of_posts = '3'; } static $id = 75; $id++; if ($cat == 'Select a Category') { $cat = ''; } if ($tag == 'Select a Tag') { $tag = ''; } $head_colors = ''; $head_class = ''; if ($display == 'category' && mom_option('nb_skin') == 'color') { $cat_color = get_option("category_" . $cat); $cat_color = isset($cat_color['color']) ? $cat_color['color'] : ''; if ($cat_color) { $head_colors .= 'style="'; $head_colors .= 'background-color:' . $cat_color . ';'; $head_colors .= '"'; $head_class = 'colorful-box'; } } $output = get_transient('mom_news_boxes_' . $id . $style . $display . $cat . $tag . $orderby . $show_more_event . $post_type); if ($orderby == 'rand') { $output = false; } $output = false; if ($output == false) { ob_start(); $dateformat = mom_option('date_format'); global $wpdb; $tag_ID = $wpdb->get_var("SELECT * FROM " . $wpdb->terms . " WHERE `name` = '" . $tag . "'"); if ($display == 'category') { if ($title == '') { $nb_title = get_cat_name($cat); } else { $nb_title = $title; } $nb_link = get_category_link($cat); } elseif ($display == 'tag') { if ($title == '') { $nb_title = $tag; } else { $nb_title = $title; } $nb_link = get_tag_link($tag_ID); } else { $nb_title = $title; $nb_link = '#'; } $sm_Atts = 'data-display="' . $display . '" data-nbs="' . $style . '" data-number_of_posts="' . $number_of_posts . '" data-cat_id="' . $cat . '" data-nb_excerpt="' . $nb_excerpt . '" data-tag="' . $tag . '"'; $post_meta_hp = mom_option('post_meta_hp'); /* if ($post_meta_hp === null) { $post_meta_hp = 1; } */ 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; } ?> <?php if ($style == 'nb2') { ?> <section class="section news-box <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 2--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <div class="nb2"> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 145, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> </div> </div> <?php } } else { } wp_reset_postdata(); ?> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> </div> <?php if ($show_more != 'no') { ?> <footer class="newb2 show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo absint($number_of_posts + 1); ?> " data-orig-offset="<?php echo absint($number_of_posts + 1); ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 2--> <?php } elseif ($style == 'nb3') { ?> <section class="section news-box <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 3--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <div class="nb3"> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 115, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); ?> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'offset' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'offset' => 2, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb3-thumb'); ?> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number('0', '1', '%'); ?> </a> </div> <?php } ?> </div> <?php } ?> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> </div> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo absint($number_of_posts + 2); ?> " data-orig-offset="<?php echo absint($number_of_posts + 2); ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 3--> <?php } elseif ($style == 'nb4') { ?> <section class="section news-box <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 4--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <div class="nb4"> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 110, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); ?> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb3-thumb'); ?> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <!-- <div class="comments-link"> <a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> --> </div> <?php } ?> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> </div> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo absint($number_of_posts + 1); ?> " data-orig-offset="<?php echo absint($number_of_posts + 1); ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 4--> <?php } elseif ($style == 'nb5') { ?> <section class="section news-box <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 5--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <div class="nb5"> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb5-thumb'); ?> <span class="post-format-icon"></span> </a></figure> <?php } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 180, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); ?> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'offset' => 1, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> </div> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo absint($number_of_posts + 1); ?> " data-orig-offset="<?php echo absint($number_of_posts + 1); ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 5--> <?php } elseif ($style == 'nb6') { ?> <section class="section news-box <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--news box 6--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <div class="nb6"> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li <?php post_class(); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('scroller-thumb'); ?> <span class="post-format-icon"></span> </a></figure> <?php } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 120, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number('0', '1', '%'); ?> </a> </div> <?php } ?> </div> <?php } ?> </div> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> </div> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo $number_of_posts; ?> " data-orig-offset="<?php echo $number_of_posts; ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--news box 6--> <?php } elseif ($style == 'list') { ?> <section class="section news-box nb1 news-list <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 1--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li <?php post_class(); ?> itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 115, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_cat != 0) { ?> <span class="cat-link"> <i class="momizat-icon-folder-open"></i><?php the_category(', '); ?> </span> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <span class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </span> <?php } ?> <div class="clear"></div> </div> <?php } ?> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo $number_of_posts; ?> " data-orig-offset="<?php echo $number_of_posts; ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 1--> <?php } else { ?> <section class="section news-box nb1 <?php if ($display == 'category') { ?> cat_<?php echo $cat; } ?> <?php echo $class; ?> "><!--News box 1--> <header class="block-title <?php echo $head_class; ?> " <?php echo $head_colors; ?> > <h2><a href="<?php echo $nb_link; ?> "><?php echo $nb_title; ?> </a></h2> <?php mom_nb_head($style, $cat, $display, $number_of_posts, $sub_categories, $orderby, $nb_excerpt); ?> </header> <ul> <?php if ($display == 'category') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'cat' => $cat, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } elseif ($display == 'tag') { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'tag' => $tag, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } else { $query = new WP_Query(array('post_status' => 'publish', 'order' => $order, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'post__not_in' => $exclude_posts, 'post_type' => $post_type, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts)); } update_post_thumbnail_cache($query); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); if ($unique_posts) { $do_unique_posts[] = get_the_ID(); } ?> <li <?php post_class(); ?> itemscope="" itemtype="http://schema.org/Article"> <?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 } ?> <?php if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 115, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> <?php } ?> </div> <?php } ?> </div> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> <?php if ($show_more != 'no') { ?> <footer class="show-more <?php echo $ajax_class; ?> " <?php echo $sm_Atts; ?> > <a href="<?php echo $nb_link; ?> " data-post_type="<?php echo $post_type; ?> " data-offset="<?php echo $number_of_posts; ?> " data-orig-offset="<?php echo $number_of_posts; ?> "><?php _e('Show More News', 'framework'); ?> </a> </footer> <?php } ?> </section><!--News box 1--> <?php } ?> <?php $output = ob_get_contents(); ob_end_clean(); set_transient('mom_news_boxes_' . $id . $style . $display . $cat . $tag . $orderby . $show_more_event . $post_type, $output, 60 * 60 * 24); } return $output; }
function mom_nb_show_more() { // stay away from bad guys $nonce = $_POST['nonce']; $nbs = $_POST['nbs']; $number_of_posts = $_POST['number_of_posts']; $orderby = $_POST['orderby']; $offset = $_POST['offset']; $offset_second = $_POST['offset_second']; $offset_all = $_POST['offset_all']; $cat = $_POST['cat']; if (!wp_verify_nonce($nonce, 'ajax-nonce')) { die('Nope!'); } $hpmeta = mom_option('post_meta_hp'); if ($nbs == 'nb1') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <li <?php post_class(); ?> itemscope="" itemtype="http://schema.org/Article"> <?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 } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 115, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </div> </li> <?php } } else { } wp_reset_postdata(); } elseif ($nbs == 'nb2') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => 1, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 145, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> </div> </div> <?php } } else { } wp_reset_postdata(); $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset_all, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { echo '<ul>'; while ($query->have_posts()) { $query->the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="comments-link"> <a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </li> <?php } echo '</ul>'; } else { } wp_reset_postdata(); } elseif ($nbs == 'nb3') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => 2, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 115, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset_all, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { echo '<ul>'; while ($query->have_posts()) { $query->the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb3-thumb'); ?> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> <?php } ?> </li> <?php } echo '</ul>'; } else { } wp_reset_postdata(); } elseif ($nbs == 'nb4') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => 1, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?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 } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 110, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset_all, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { echo '<ul>'; while ($query->have_posts()) { $query->the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb3-thumb'); ?> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <!-- <div class="comments-link"> <a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> --> </div> <?php } ?> </li> <?php } echo '</ul>'; } else { } wp_reset_postdata(); } elseif ($nbs == 'nb5') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => 1, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb5-thumb'); ?> <span class="post-format-icon"></span> </a></figure> <?php } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 180, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </div> </div> <?php } } else { } wp_reset_postdata(); $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset_all, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { echo '<ul>'; while ($query->have_posts()) { $query->the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="comments-link"> <a href="#"><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <?php } ?> </li> <?php } echo '</ul>'; } else { } wp_reset_postdata(); } elseif ($nbs == 'nb6') { $query = new WP_Query(array('cat' => $cat, 'posts_per_page' => $number_of_posts, 'offset' => $offset, 'orderby' => $orderby, 'post_status' => 'publish')); if ($query->have_posts()) { echo '<ul>'; while ($query->have_posts()) { $query->the_post(); ?> <li <?php post_class(); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('nb5-thumb'); ?> <span class="post-format-icon"></span> </a></figure> <?php } if (mom_post_image() != false) { $mom_class = ' class="fix-right-content"'; } else { $mom_class = ''; } ?> <div<?php echo $mom_class; ?> > <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <?php if ($nb_excerpt != '0') { ?> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } if ($nb_excerpt == '') { echo wp_html_excerpt(strip_shortcodes($excerpt), 120, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), $nb_excerpt, '...'); } ?> </p> <?php } ?> </div> <?php if ($hpmeta == 1) { ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="#"><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> <?php } ?> </div> </li> <?php } echo '</ul>'; } else { } wp_reset_postdata(); } exit; }
function mom_blog_post($style = 1, $nexcerpt, $class) { global $post; $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 ($style == 'large') { ?> <article <?php post_class('blog-post-big nb1 ' . $class); ?> itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"> <a href="<?php the_permalink(); ?> "> <?php $thumbsize = 'blogb-thumb'; if (mom_option('site_width') == 'wide') { $thumbsize = 'big-thumb-hd'; } mom_post_image_full($thumbsize); ?> <span class="post-format-icon"></span> </a> </figure> <?php } ?> <h2 itemprop="name"> <a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </h2> <?php if ($post_head != 0) { ?> <div class="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 mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_cat != 0) { ?> <div class="cat-link"> <span>|</span><?php _e('in :', 'framework'); ?> <?php the_category(', '); ?> </div> <?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 } ?> <div class="entry-content"> <?php $excerpt = get_the_excerpt(); if ($excerpt == false) { $excerpt = get_the_content(); } if ($nexcerpt != '') { echo wp_html_excerpt(strip_shortcodes($excerpt), $nexcerpt, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), 304, '...'); } ?> </div> <?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 } ?> </article> <?php } elseif ($style == 'grid') { $dateformat = mom_option('date_format'); ?> <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 } else { ?> <article <?php post_class('blog-post nb1 ' . $class); ?> itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"> <a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </h2> <?php if ($post_head != 0) { ?> <div class="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 mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_cat != 0) { ?> <div class="cat-link"> <span>|</span><?php _e('in :', 'framework'); ?> <?php the_category(', '); ?> </div> <?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('blog-thumb'); ?> <span class="post-format-icon"></span> </a> </figure> <?php } ?> <div class="entry-content"> <?php $excerpt = get_the_excerpt(); if ($excerpt == false) { $excerpt = get_the_content(); } if ($nexcerpt != '') { echo wp_html_excerpt(strip_shortcodes($excerpt), $nexcerpt, '...'); } else { echo wp_html_excerpt(strip_shortcodes($excerpt), 170, '...'); } ?> </div> <?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 } ?> </article> <?php } }
?> ... </p> </div> <?php if ($post_head != 0) { ?> <div class="entry-meta"> <?php if ($post_head_date != 0) { ?> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php echo mom_date_format(); ?> </time> <?php } ?> <?php if ($post_head_commetns != 0) { ?> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php comments_link(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?>
function mom_nb_tabs() { // stay away from bad guys $nonce = $_POST['nonce']; $nbs = $_POST['nbs']; $number_of_posts = $_POST['number_of_posts']; $cat = $_POST['cat']; if (!wp_verify_nonce($nonce, 'ajax-nonce')) { die('Nope!'); } ?> <?php if ($nbs == 'nb1') { ?> <?php query_posts(array('posts_per_page' => $number_of_posts, 'post_status' => 'publish', 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <li <?php post_class(); ?> itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb1-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 115); ?> ... </p> </div> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_query(); ?> <?php } elseif ($nbs == 'nb2') { ?> <?php $nb2_first_query = new WP_Query(array('posts_per_page' => 1, 'post_status' => 'publish', 'cat' => $cat)); if ($nb2_first_query->have_posts()) { while ($nb2_first_query->have_posts()) { $nb2_first_query->the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 145); ?> ... </p> </div> </div> <?php } } else { } wp_reset_postdata(); ?> <ul> <?php $nb_next_query = new WP_Query(array('posts_per_page' => $number_of_posts, 'post_status' => 'publish', 'offset' => 1, 'cat' => $cat)); if ($nb_next_query->have_posts()) { while ($nb_next_query->have_posts()) { $nb_next_query->the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="comments-link"> <a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_postdata(); ?> </ul> <?php } elseif ($nbs == 'nb3') { ?> <?php query_posts(array('showposts' => 2, 'post_status' => 'publish', 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb1-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 115); ?> ... </p> </div> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </div> <?php } } else { } wp_reset_query(); ?> <ul> <?php query_posts(array('showposts' => $number_of_posts, 'post_status' => 'publish', 'offset' => 2, 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb3-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_query(); ?> </ul> <?php } elseif ($nbs == 'nb4') { ?> <?php query_posts(array('showposts' => 1, 'post_status' => 'publish', 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb1-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 110); ?> ... </p> </div> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </div> <?php } } else { } wp_reset_query(); ?> <ul> <?php query_posts(array('showposts' => $number_of_posts, 'post_status' => 'publish', 'offset' => 1, 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb3-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_query(); ?> </ul> <?php } elseif ($nbs == 'nb5') { ?> <?php query_posts(array('showposts' => 1, 'post_status' => 'publish', 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <div <?php post_class('first-item'); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb5-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 180); ?> ... </p> </div> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="<?php the_permalink(); ?> "><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </div> <?php } } else { } wp_reset_query(); ?> <ul> <?php query_posts(array('showposts' => $number_of_posts, 'post_status' => 'publish', 'offset' => 1, 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <li role="article" itemscope="" itemtype="http://schema.org/Article"> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="comments-link"> <a href="#"><?php comments_number(__('(0) Comments', 'framework'), __('(1) Comment', 'framework'), __('(%) Comments', 'framework')); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_query(); ?> </ul> <?php } elseif ($nbs == 'nb6') { ?> <ul> <?php query_posts(array('showposts' => $number_of_posts, 'post_status' => 'publish', 'cat' => $cat)); if (have_posts()) { while (have_posts()) { the_post(); ?> <li <?php post_class(); ?> role="article" itemscope="" itemtype="http://schema.org/Article"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"><a href="<?php the_permalink(); ?> "> <img itemprop="image" src="<?php echo mom_post_image('nb6-thumb'); ?> " data-hidpi="<?php echo mom_post_image('big-thumb-hd'); ?> " alt="<?php the_title(); ?> "> <span class="post-format-icon"></span> </a></figure> <?php } ?> <h2 itemprop="name"><a itemprop="url" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="entry-content"> <p> <?php global $post; $excerpt = $post->post_excerpt; if ($excerpt == '') { $excerpt = get_the_content(''); } echo wp_html_excerpt(strip_shortcodes($excerpt), 120); ?> ... </p> </div> <div class="entry-meta"> <time class="entry-date" datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><i class="momizat-icon-calendar"></i><?php mom_date_format(); ?> </time> <div class="comments-link"> <i class="momizat-icon-bubbles4"></i><a href="#"><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> </li> <?php } } else { } wp_reset_query(); ?> </ul> <?php } exit; }
function mom_ajax_media_tab() { // stay away from bad guys $nonce = $_POST['nonce']; if (!wp_verify_nonce($nonce, 'ajax-nonce')) { die('Nope!'); } $type = $_POST['type']; $order = isset($_POST['order']) ? $_POST['order'] : ''; if ($type == 'all') { $type = array('post-format-audio', 'post-format-video', 'post-format-gallery'); } else { $type = array('post-format-' . $type); } if ($order == 'popular') { $order = 'comment_count'; } else { $order = 'date'; } ?> <ul class="media-items-list clearfix"> <?php $args = array('post_type' => 'post', 'posts_per_page' => -1, 'orderby' => $order, 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $type, 'operator' => 'IN'))); $query = new WP_Query($args); $i = 0; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); global $posts_st; $extra = get_post_meta(get_the_ID(), $posts_st->get_the_id(), TRUE); if (isset($extra['video_type'])) { $video_type = $extra['video_type']; } if (isset($extra['video_id'])) { $video_id = $extra['video_id']; } if (isset($extra['html5_mp4_url'])) { $html5_mp4 = $extra['html5_mp4_url']; } if (isset($extra['html5_duration'])) { $html5_duration = $extra['html5_duration']; } else { $html5_duration = '00:00'; } if (isset($extra['slides'])) { $slides = $extra['slides']; } else { $slides = ''; } $post_format = get_post_format(); $num_of_slides = $post_format == 'gallery' ? count($slides) : ''; if ($i < 2) { ?> <li <?php post_class('media-item featured'); ?> > <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"> <a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('media1-thumb'); ?> </a> <div class="media-data"> <div class="media-format"></div> <?php if ($post_format == 'video') { if ($video_type == 'youtube') { ?> <div class="video-time"> <?php echo mom_youtube_duration($video_id); ?> </div> <?php } elseif ($video_type == 'vimeo') { ?> <div class="video-time"> <?php echo mom_vimeo_duration($video_id); ?> </div> <?php } else { ?> <div class="video-time"> <?php echo $html5_duration; ?> </div> <?php } } elseif ($post_format == 'gallery') { ?> <div class="video-time"><?php echo $num_of_slides; ?> </div> <?php } else { ?> <div class="video-time"> <?php echo $html5_duration; ?> </div> <?php } ?> </div> </figure> <?php } ?> <h2><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="cat-link"> <?php the_category(', '); ?> </div> </div> </li> <?php } else { ?> <li <?php post_class('media-item m-items'); ?> id="m-items"> <?php if (mom_post_image() != false) { ?> <figure class="post-thumbnail"> <a href="<?php the_permalink(); ?> "> <?php mom_post_image_full('media-thumb'); ?> </a> <div class="media-data"> <div class="media-format"></div> <?php if ($post_format == 'video') { if ($video_type == 'youtube') { ?> <div class="video-time"> <?php echo mom_youtube_duration($video_id); ?> </div> <?php } elseif ($video_type == 'vimeo') { ?> <div class="video-time"> <?php echo mom_vimeo_duration($video_id); ?> </div> <?php } else { ?> <div class="video-time"> <?php echo $html5_duration; ?> </div> <?php } } elseif ($post_format == 'gallery') { ?> <div class="video-time"><?php echo $num_of_slides; ?> </div> <?php } else { ?> <div class="video-time"> <?php echo $html5_duration; ?> </div> <?php } ?> </div> </figure> <?php } ?> <h2><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h2> <div class="entry-meta"> <time datetime="<?php the_time('c'); ?> " itemprop="dateCreated"><?php mom_date_format(); ?> </time> <div class="cat-link"> <?php the_category(', '); ?> </div> </div> </li> <?php } $i++; } } else { } wp_reset_postdata(); ?> </ul> <?php exit; }