if ($url != "") { $shortcode[] = '<img alt="" src="' . esc_url($url) . '" />'; $class_blog = "blog-thumbnail"; } $audio = get_post_meta($post->ID, 'audio_setting', true); if ($audio != "") { $shortcode[] = $audio; $class_blog = "blog-audio"; } $video = get_post_meta($post->ID, 'video_setting', true); if ($video != "") { $shortcode[] = $video; $class_blog = "blog-video"; } if (jv_get_album($post->ID) != "") { $shortcode[] = jv_get_album($post->ID); $class_blog = "blog-gallery"; } if ($shortcode == "") { $shortcode = array(); } ?> <?php if ($col > 1) { ?> <div class="itemMasonry col-md-<?php echo esc_attr($cols); ?> col-sm-6 col-xs-6">
<div class='item'> <div class="innerItem"> <?php if ($args['thumb']) { ?> <?php $audio = get_post_meta(get_the_ID(), 'audio_setting', true); ?> <?php $video = get_post_meta(get_the_ID(), 'video_setting', true); ?> <?php $album = function_exists('jv_get_album') ? jv_get_album(get_the_ID()) : ''; ?> <?php $album = apply_filters('jv_get_album', $album); ?> <?php if (has_post_thumbnail() or $audio or $video or $album) { ?> <?php if ($audio or $video or $album) { ?> <?php
/** * Generates the posts markup. * * @since 0.9.4 * @param array $args * @return string|array The HTML for the random posts. */ function rpwe_get_recent_posts($args = array()) { // Set up a default, empty variable. $html = ''; // Merge the input arguments and the defaults. $args = wp_parse_args($args, rpwe_get_default_args()); // Extract the array to allow easy use of variables. extract($args); // Allow devs to hook in stuff before the loop. do_action('rpwe_before_loop'); // Get the posts query. $posts = rpwe_get_posts($args); if ($posts->have_posts()) { $tmpl = apply_filters('rpwe_tmpl', $args['tmpl']); $template_name = "{$tmpl}.php"; if (file_exists(STYLESHEETPATH . '/' . $template_name)) { $tmpl = STYLESHEETPATH . '/' . $template_name; } else { if (file_exists(TEMPLATEPATH . '/' . $template_name)) { $tmpl = TEMPLATEPATH . '/' . $template_name; } } if (file_exists($tmpl)) { ob_start(); require $tmpl; $html = ob_get_clean(); } else { ?> <?php ob_start(); ?> <div <?php echo !empty($args['cssID']) ? 'id="' . sanitize_html_class($args['cssID']) . '"' : ''; ?> class="rpwe-block <?php echo !empty($args['css_class']) ? '' . sanitize_html_class($args['css_class']) . '' : ''; ?> "> <?php if (!empty($args['title'])) { ?> <h2 class="widgettitle"> <?php echo apply_filters('esc_html', $args['title']); ?> <?php if (!empty($args['subtitle'])) { ?> <span class="sub-title"><?php echo apply_filters('esc_html', $args['subtitle']); ?> </span> <?php } ?> </h2> <?php } ?> <div class="rpwe-div jv-posts <?php if ($args['col'] > 1) { echo 'row'; } ?> "> <?php while ($posts->have_posts()) { $posts->the_post(); ?> <?php // Thumbnails $thumb_id = get_post_thumbnail_id(); // Get the featured image id. $img_url = wp_get_attachment_url($thumb_id); // Get img URL. // Display the image url and crop using the resizer. $image = rpwe_resize($img_url, $args['thumb_width'], $args['thumb_height'], true); if (!($args['thumb_width'] + $args['thumb_height'])) { $image = $img_url; } ?> <?php if ($args['col'] > 1) { ?> <div class="<?php echo 'col-md-' . 12 / sanitize_html_class($args['col']); ?> "> <?php } ?> <div class="item"> <div class="innerItem"> <?php if ($args['thumb']) { ?> <?php $audio = get_post_meta(get_the_ID(), 'audio_setting', true); ?> <?php $video = get_post_meta(get_the_ID(), 'video_setting', true); ?> <?php $album = function_exists('jv_get_album') ? jv_get_album(get_the_ID()) : ''; ?> <?php $album = apply_filters('jv_get_album', $album); ?> <?php if (has_post_thumbnail() or $audio or $video or $album) { ?> <?php if ($audio or $video or $album) { ?> <?php if ($audio and $video) { ?> <?php $media = $video; ?> <?php } else { ?> <?php $media = $audio . $video . $album; ?> <?php } ?> <?php echo apply_filters('the_content', $media); ?> <?php } else { ?> <a class="rpwe-img moduleItemImage" href="<?php echo esc_url(get_permalink()); ?> " rel="bookmark"> <?php if ($image) { ?> <img class="<?php echo esc_attr($args['thumb_align']); ?> rpwe-thumb" src="<?php echo esc_url($image); ?> " alt="<?php echo esc_attr(get_the_title()); ?> "> <?php } else { ?> <?php get_the_post_thumbnail(get_the_ID(), array($args['thumb_width'], $args['thumb_height']), array('class' => $args['thumb_align'] . ' rpwe-thumb the-post-thumbnail', 'alt' => esc_attr(get_the_title()))); ?> <?php } ?> </a> <?php } ?> <?php } elseif (function_exists('get_the_image')) { ?> <?php echo get_the_image(array('height' => (int) $args['thumb_height'], 'width' => (int) $args['thumb_width'], 'image_class' => esc_attr($args['thumb_align']) . ' rpwe-thumb get-the-image', 'image_scan' => true, 'echo' => false, 'default_image' => esc_url($args['thumb_default']))); ?> <?php } elseif (!empty($args['thumb_default'])) { ?> <?php echo sprintf('<a class="rpwe-img" href="%1$s" rel="bookmark"><img class="%2$s rpwe-thumb rpwe-default-thumb" src="%3$s" alt="%4$s" width="%5$s" height="%6$s"></a>', esc_url(get_permalink()), esc_attr($args['thumb_align']), esc_url($args['thumb_default']), esc_attr(get_the_title()), (int) $args['thumb_width'], (int) $args['thumb_height']); } } ?> <div class="content-item-description"> <?php if (isset($args['dtitle']) && intval($args['dtitle'])) { ?> <h4 class="post-title"> <a href="<?php echo esc_url(get_permalink()); ?> " title="<?php echo sprintf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?> " rel="bookmark"><?php echo esc_attr(get_the_title()); ?> </a> </h4> <?php } ?> <?php if ($args['date'] or intval($args['dcategory']) && ($cposts = get_the_category(get_the_ID())) && count($cposts) or intval($args['dauthor']) or intval($args['dcomment'])) { ?> <div class="ItemLinks ItemLinksInline "> <?php if ($args['date']) { ?> <span> <?php if ($idate = apply_filters('rpwe_icon', 'date', $args['idate'])) { ?> <i class="<?php echo $idate; ?> "></i> <?php } ?> <span class="d"><?php echo apply_filters('get_the_date', get_the_date('d')); ?> </span> <span class="m"><?php echo apply_filters('get_the_date', get_the_date('M')); ?> </span> <span class="y"><?php echo apply_filters('get_the_date', get_the_date('Y')); ?> </span> </span> <?php } ?> <?php if (intval($args['dcategory']) && ($cposts = get_the_category(get_the_ID())) && count($cposts)) { ?> <span class="categories"> <?php if ($icategory = apply_filters('rpwe_icon', 'category', $args['icate'])) { ?> <i class="<?php echo $icategory; ?> "></i> <?php } ?> <?php foreach ($cposts as $cpost) { ?> <a class="category-name" href="<?php echo get_category_link($cpost->term_id); ?> "> <?php echo esc_html($cpost->cat_name); ?> </a> <?php } ?> <?php } ?> <?php if (intval($args['dtag']) && ($tags_post = get_the_tags(get_the_ID())) && count($tags_post)) { ?> <span class="categories"> <?php if ($itag = apply_filters('rpwe_icon', 'tag', $args['itag'])) { ?> <i class="<?php echo $itag; ?> "></i> <?php } ?> <?php foreach ($tags_post as $tag_post) { ?> <span class="tag-name"> <?php echo esc_html($tag_post->name); ?> </span> <?php } ?> </span> <?php } ?> <?php if (intval($args['dauthor'])) { ?> <span> <?php if ($iauthor = apply_filters('rpwe_icon', 'author', $args['iauthor'])) { ?> <i class="<?php echo $iauthor; ?> "></i> <?php } ?> <?php echo get_the_author_link(); ?> </span> <?php } ?> <?php if (intval($args['dcomment'])) { $comments = get_comments(array('post_id' => get_the_ID(), 'count' => 1)); $clink = get_comments_link(get_the_ID()); $icomment = apply_filters('rpwe_icon', 'comment', $args['icomment']); ?> <?php echo sprintf('<a href="%1$s" class="moduleItemComments"><i class="%2$s"></i> %3$s</a>', $clink, $icomment, $comments); } ?> </div> <?php } ?> <?php if (isset($args['excerpt']) && intval($args['excerpt'])) { ?> <div class="moduleItemIntrotext"> <?php echo wp_trim_words(apply_filters('the_content', get_the_content()), $args['length'], ' […]'); ?> </div> <?php } ?> <?php if ($args['readmore']) { ?> <div class="readmore"> <a href="<?php echo esc_url(get_permalink()); ?> " class="moduleItemReadMore"> <?php echo apply_filters('rpwe_readmore', $args['readmore_text']); ?> </a> </div> <?php } ?> </div> </div> </div> <?php if ($args['col'] > 1) { ?> </div> <?php } ?> <?php } ?> </div> </div> <?php $html = ob_get_clean(); } } // Restore original Post Data. wp_reset_postdata(); // Allow devs to hook in stuff after the loop. do_action('rpwe_after_loop'); // Return the posts markup. return $args['before'] . apply_filters('rpwe_markup', $html) . $args['after']; }