?> </div> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"> <?php if (has_post_thumbnail() || news_magazine_frontend_functions::post_image_url() && $blog_style && $grab_image) { ?> <div class="img_container fixed size180x150"> <?php echo news_magazine_frontend_functions::fixed_thumbnail(180, 150, $grab_image); ?> </div> <?php } ?> </a> <?php if ($blog_style) { the_excerpt(); } else { the_content(); } ?> <p><a href="<?php the_permalink();
public static function content_posts($paged = 1) { global $wp_query, $wdwt_front, $post; $hide_content_posts = $wdwt_front->get_param('hide_content_posts'); $hide_video_post = $wdwt_front->get_param('hide_video_post'); $content_post_categories = $wdwt_front->get_param('content_post_categories', array(), array('')); $content_post_cat_name = $wdwt_front->get_param('content_post_cat_name'); $blog_style = $wdwt_front->get_param('blog_style'); $content_post_categories = implode(',', $content_post_categories); $cat_checked = 0; $grab_image = $wdwt_front->get_param('grab_image'); $n_of_home_post = get_option('posts_per_page', 6); if ($hide_content_posts && $n_of_home_post != 0) { ?> <div id="content_posts_section"> <div id="blog" class="content-inner-block"> <?php $wp_query = new WP_Query('posts_per_page=' . $n_of_home_post . '&ignore_sticky_posts=1&cat=' . news_magazine_frontend_functions::remove_last_comma($content_post_categories) . '&paged=' . $paged . '&order=DESC'); ?> <div class="blog-post"> <h2><?php echo esc_html($content_post_cat_name); ?> </h2> <div id="blog_post"> <ul id="list"> <?php if (have_posts()) { while ($wp_query->have_posts()) { $wp_query->the_post(); $tumb_id = get_post_thumbnail_id($post->ID); $thumb_url = wp_get_attachment_image_src($tumb_id, 'full'); $has_thumb = true; if ($thumb_url) { $thumb_url = $thumb_url[0]; } else { $thumb_url = news_magazine_frontend_functions::catch_that_image(); if (isset($thumb_url['image_catched']) && $thumb_url['image_catched']) { $has_thumb = true; } else { $has_thumb = false; } $thumb_url = $thumb_url['src']; } ?> <li> <div class="latest_posts <?php if ($has_thumb) { echo "has_thumb"; } ?> "> <?php echo news_magazine_frontend_functions::fixed_thumbnail(145, 100, $grab_image); ?> <span class="date lat_news"><?php echo get_the_time('d M'); ?> </span> </div> <h3><a href="<?php echo get_permalink(); ?> "><?php the_title(); ?> </a></h3></br> <p> <?php news_magazine_frontend_functions::the_excerpt_max_charlength(100); ?> </p> </li> <?php } } ?> </ul> <div class="section_pagination"> <?php if ($paged > 1) { ?> <span class="content_posts_pagination prev_section" id="content_posts_left" onclick="wdwt_front_ajax_pagination(<?php echo $paged - 1; ?> , 'content_posts_section', '#content_posts_section');" ><i class="fa fa-chevron-left"></i> <b>Previous</b></span> <?php } if ($paged < $wp_query->max_num_pages) { ?> <span class="content_posts_pagination next_section" id="content_posts_right" onclick="wdwt_front_ajax_pagination(<?php echo $paged + 1; ?> , 'content_posts_section', '#content_posts_section');"><b>Next</b> <i class="fa fa-chevron-right"></i></span> <?php } ?> </div> </div> </div> </div> <div class="clear"></div> </div> <?php } wp_reset_query(); }
function widget($args, $instance) { extract($args); $title = esc_html($instance['title']); $categ_id = empty($instance['categ_id']) ? '' : $instance['categ_id']; $post_count = empty($instance['post_count']) ? '' : $instance['post_count']; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <style> .cat_widg p { margin: 0 0 13px !important; } .cat_widg { padding-bottom: 10px; margin-bottom: 5px; border-bottom: 1px solid #ededed; float: left; width: 100%; } .widget_exclusive_categ div:last-child div{ border-bottom:none !important; } .cat_widg_cont { width: 100%; } .cat_widg_cont h3{ font-size: 19px !important; margin-top: 0; line-height: 15px; margin-bottom: 8px !important; } .cat_widg_cont h3 a{ font-size:19px !important; } .widget-title{ margin-bottom: 0; } .cat_widg-img{ width: 90px; height: 70px; float: left; overflow: hidden; margin: 0 10px 10px 0 !important; } </style> <?php $wp_query = null; $wp_query = new WP_Query(); if (!isset($post_count)) { $post_count = 0; } $wp_query->query('posts_per_page=' . $post_count . '&cat=' . $categ_id); while ($wp_query->have_posts()) { $wp_query->the_post(); ?> <div class="cat_widg_cont"> <a href="<?php the_permalink(); ?> "> <span style="font-size: 17px;"><?php the_title(); ?> </span> </a> <div class="cat_widg"> <a href="<?php the_permalink(); ?> "> <div class="cat_widg-img"> <?php echo news_magazine_frontend_functions::fixed_thumbnail(150, 70); ?> </div> </a> <p> <?php echo news_magazine_frontend_functions::the_excerpt_max_charlength(100); ?> </p> </div> <div style="clear:both;"></div> </div> <?php } echo $after_widget; }