'', 'display_title' => '', 'display_summary' => '', 'display_author' => '', 'display_post_date' => '', 'display_taxonomy' => '', 'taxonomy_chosen' => 'category', 'image_linkable' => '', 'post_link_new_window' => '', 'image_size' => 'large',), lvca_get_default_atts_carousel() ); $settings = shortcode_atts($defaults, $atts); $taxonomies = array(); $posts_query = $settings['posts_query']; if (is_array($posts_query)) { $posts_query['post_status'] = 'publish'; } else { $posts_query .= '|post_status:publish'; } if (function_exists('vc_build_loop_query')) { $posts_query = apply_filters('lvca_posts_carousel_posts_query', $posts_query, $settings); list($query_args, $loop) = vc_build_loop_query($posts_query); } else { $query_args = array('posts_per_page' => 10, 'ignore_sticky_posts' => 1); $query_args = apply_filters('lvca_posts_carousel_query_args', $query_args, $settings); // just display first 10 posts if the user came directly to this shortcode $loop = new WP_Query($query_args); } $output = ''; // Loop through the posts and do something with them. if ($loop->have_posts()) : // get me all array key value pairs except for those keys listed $carousel_settings = array_diff_key($settings, array('posts_query' => '', 'image_linkable' => '', 'display_title' => '', 'display_summary' => '')); $uniqueid = uniqid(); $output .= ''; endif; return apply_filters('lvca_posts_carousel_output', $output, $settings); } function map_vc_element() { if (function_exists("vc_map")) { $carousel_params = array( array( 'type' => 'loop', 'param_name' => 'posts_query', 'heading' => __('Posts query', 'livemesh-vc-addons'), 'value' => 'size:10|order_by:date', 'settings' => array( 'size' => array( 'hidden' => false, 'value' => 10, ), 'order_by' => array('value' => 'date'), 'post_type' => array( 'hidden' => false, 'value' => 'jetpack-portfolio', ), ), 'description' => __('Create WordPress loop, to populate content from your site.', 'livemesh-vc-addons'), 'admin_label' => true ), array( 'type' => 'checkbox', 'param_name' => 'image_linkable', 'heading' => __('Link Images to Posts?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), ), array( 'type' => 'checkbox', 'param_name' => 'post_link_new_window', 'heading' => __('Open post links in new window?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), ), array( 'type' => 'dropdown', 'param_name' => 'image_size', 'heading' => __('Image Size', 'livemesh-vc-addons'), 'std' => 'large', 'value' => lvca_get_image_sizes() ), array( 'type' => 'dropdown', 'param_name' => 'taxonomy_chosen', 'heading' => __('Choose the taxonomy to display info.', 'livemesh-vc-addons'), 'description' => __('Choose the taxonomy to use for display of taxonomy information for posts/custom post types.', 'livemesh-vc-addons'), 'value' => lvca_get_taxonomies_map(), 'std' => 'category', 'group' => __('Post Info', 'livemesh-vc-addons'), ), array( 'type' => 'checkbox', 'param_name' => 'display_title', 'heading' => __('Display posts title below the post item?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), 'group' => __('Post Info', 'livemesh-vc-addons'), ), array( 'type' => 'checkbox', 'param_name' => 'display_author', 'heading' => __('Display post author info below the post item?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), 'group' => __('Post Info', 'livemesh-vc-addons'), ), array( 'type' => 'checkbox', 'param_name' => 'display_post_date', 'heading' => __('Display post date info below the post item?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), 'group' => __('Post Info', 'livemesh-vc-addons'), ), array( 'type' => 'checkbox', 'param_name' => 'display_taxonomy', 'heading' => __('Display taxonomy info below the post item?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), 'group' => __('Post Info', 'livemesh-vc-addons'), ), array( 'type' => 'checkbox', 'param_name' => 'display_summary', 'heading' => __('Display post excerpt/summary below the post item?', 'livemesh-vc-addons'), "value" => array(__("Yes", "livemesh-vc-addons") => 'true'), 'group' => __('Post Info', 'livemesh-vc-addons'), ), ); $carousel_params = array_merge($carousel_params, lvca_get_vc_map_carousel_options('Options')); $carousel_params = array_merge($carousel_params, lvca_get_vc_map_carousel_display_options()); //Register "container" content element. It will hold all your inner (child) content elements vc_map(array( "name" => __("Posts Carousel", "livemesh-vc-addons"), "base" => "lvca_posts_carousel", "content_element" => true, "show_settings_on_create" => true, "category" => __("Livemesh Addons", "livemesh-vc-addons"), 'description' => __('Display posts or post types as a carousel.', 'livemesh-vc-addons'), "icon" => 'icon-lvca-posts-carousel', "params" => $carousel_params )); } } } if (class_exists('WPBakeryShortCode')) { class WPBakeryShortCode_lvca_posts_carousel extends WPBakeryShortCode { } } // Initialize Element Class if (class_exists('LVCA_Posts_Carousel')) { new LVCA_Posts_Carousel(); }