function etheme_recent_posts_shortcode($atts) { $a = shortcode_atts(array('title' => 'Recent Posts', 'limit' => 10, 'cat' => '', 'imgwidth' => 300, 'imgheight' => 200, 'imgcrop' => 1, 'date' => 0, 'excerpt' => 0, 'more_link' => 1), $atts); $args = array('post_type' => 'post', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $a['limit'], 'cat' => $a['cat']); $crop = $a['imgcrop'] == 1; ob_start(); etheme_create_posts_slider($args, $a['title'], $a['more_link'], $a['date'], $a['excerpt'], $a['imgwidth'], $a['imgheight'], $crop); $output = ob_get_contents(); ob_end_clean(); return $output; }
function vc_theme_vc_posts_slider($atts, $content = null) { $output = $title = $type = $count = $interval = $slides_content = $link = ''; $custom_links = $thumb_size = $posttypes = $posts_in = $categories = ''; $orderby = $order = $el_class = $link_image_start = ''; extract(shortcode_atts(array('title' => '', 'type' => 'flexslider_fade', 'count' => 10, 'interval' => 3, 'layout' => 'vertical', 'slides_content' => '', 'slides_title' => '', 'link' => 'link_post', 'more_link' => 1, 'custom_links' => site_url() . '/', 'thumb_size' => '300x200', 'posttypes' => '', 'posts_in' => '', 'slides_date' => false, 'categories' => '', 'orderby' => NULL, 'order' => 'DESC', 'el_class' => '', 'desktop' => 3, 'notebook' => 3, 'tablet' => 2, 'phones' => 1), $atts)); $gal_images = ''; $link_start = ''; $link_end = ''; $el_start = ''; $el_end = ''; $slides_wrap_start = ''; $slides_wrap_end = ''; $el_class = ' ' . $el_class . ' '; $query_args = array(); //exclude current post/page from query if ($posts_in == '') { global $post; $query_args['post__not_in'] = array($post->ID); } else { if ($posts_in != '') { $query_args['post__in'] = explode(",", $posts_in); } } // Post teasers count if ($count != '' && !is_numeric($count)) { $count = -1; } if ($count != '' && is_numeric($count)) { $query_args['posts_per_page'] = $count; } // Post types $pt = array(); if ($posttypes != '') { $posttypes = explode(",", $posttypes); foreach ($posttypes as $post_type) { array_push($pt, $post_type); } $query_args['post_type'] = $pt; } // Narrow by categories if ($categories != '') { $categories = explode(",", $categories); $gc = array(); foreach ($categories as $grid_cat) { array_push($gc, $grid_cat); } $gc = implode(",", $gc); ////http://snipplr.com/view/17434/wordpress-get-category-slug/ $query_args['category_name'] = $gc; $taxonomies = get_taxonomies('', 'object'); $query_args['tax_query'] = array('relation' => 'OR'); foreach ($taxonomies as $t) { if (in_array($t->object_type[0], $pt)) { $query_args['tax_query'][] = array('taxonomy' => $t->name, 'terms' => $categories, 'field' => 'slug'); } } } // Order posts if ($orderby != NULL) { $query_args['orderby'] = $orderby; } $query_args['order'] = $order; $thumb_size = explode('x', $thumb_size); $width = $thumb_size[0]; $height = $thumb_size[1]; $crop = true; $customItems = array('desktop' => $desktop, 'notebook' => $notebook, 'tablet' => $tablet, 'phones' => $phones); ob_start(); etheme_create_posts_slider($query_args, $title, $more_link, $slides_date, $slides_content, $width, $height, $crop, $layout, $customItems, $el_class); $output = ob_get_contents(); ob_end_clean(); return $output; }
function et_get_related_posts($postId = false, $limit = 5) { global $post; if (!$postId) { $postId = $post->ID; } $categories = get_the_category($postId); if ($categories) { $category_ids = array(); foreach ($categories as $individual_category) { $category_ids[] = $individual_category->term_id; } $args = array('category__in' => $category_ids, 'post__not_in' => array($postId), 'showposts' => $limit, 'caller_get_posts' => 1); etheme_create_posts_slider($args, __('Related posts', ETHEME_DOMAIN), false, true, true); } }