';
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
$content = fruitful_load_template_part();
if ( !empty( $content ) ) {
$out .= $content;
} else {
$day = get_the_date('d');
$month_abr = get_the_date('M');
$the_ID = get_the_ID();
$post_class = get_post_class();
$the_permalink = get_the_permalink();
$title = esc_attr( sprintf( __( 'Permalink to %s', 'fruitful' ), the_title_attribute( 'echo=0' ) ) );
$the_title = get_the_title();
$the_post_thumbnail = get_the_post_thumbnail();
$the_excerpt = get_the_excerpt();
if( empty($the_excerpt) ) {
$the_excerpt = get_the_content();
}
$the_category = get_the_category_list( ', ', 'fruitful' );
$comments = get_comments_popup_link( __( 'Leave a comment', 'fruitful' ), __( '1 Comment', 'fruitful' ), __( '% Comments', 'fruitful' ) );
$out .= '
';
$out .= '
'.$day.'
'.$month_abr.'
';
$out .= '
';
$out .= '
';
if ( has_post_thumbnail() && ! post_password_required() ) :
$out .='
'
.$the_post_thumbnail.
'
';
endif;
$out .= do_shortcode($the_excerpt).
'
';
$out .= '
';
$out .= '
';
}
endwhile;
}
$out .= '
';
wp_reset_postdata();
if(isset($out)) return $out;
}
add_shortcode ("fruitful_recent_posts", "fruitful_recent_posts");
function fruitful_recent_posts_slider($atts){
//Add FlexSlider
wp_enqueue_style( 'flex-slider', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/flex_slider/slider.css');
wp_enqueue_script('flex-fitvid-j', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/flex_slider/jquery.flexslider-min.js', array( 'jquery' ), '20130930', false );
wp_enqueue_script('flex-slider', FRUITFUL_SHORTCODE_URI . 'includes/shortcodes/js/slider_init.js', array( 'jquery' ));
$posts = $cat = $out = '';
$this_id = get_the_ID();
extract(shortcode_atts(array(
'posts' => 4,
'cat' => ''
), $atts));
if(!empty($cat)) {
$cats = explode(", ", $cat);
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'post__not_in' => array($this_id),
'ignore_sticky_posts' => true,
'posts_per_page'=> $posts,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $cats
)
)
);
} else {
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'post__not_in' => array($this_id),
'ignore_sticky_posts' => true,
'posts_per_page'=> $posts
);
}
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$out .= '