false, 'quantity' => 1, 'posttype' => 'post', 'offset' => 0, 'category' => false ), $atts ) ); $quantity = (int)$quantity; if(!is_numeric($quantity)) { $quantity = 1; } if(!is_numeric($offset)) { $offset = 0; } /** * Query for my content */ $args = array( 'post_type' => $posttype, 'posts_per_page' => $quantity, 'post_status' => 'publish', 'paged' => 1, 'suppress_filters' => false, 'offset' => esc_attr($offset), 'ignore_sticky_posts' => 1, 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ), ) ); /** * Add category parameters to query if any is set */ if (false !== $category && 'all' !== $category) { $args[ 'tax_query'] = array( array( 'taxonomy' => esc_attr( vlogger_get_type_taxonomy( $posttype ) ), 'field' => 'slug', 'terms' => array(esc_attr($category)), 'operator'=> 'IN' //Or 'AND' or 'NOT IN' ) ); } // ========== EVENTS ONLY QUERY ================= if($posttype == 'event'){ $args['orderby'] = 'meta_value'; $args['order'] = 'ASC'; $args['meta_key'] = 'eventdate'; $args['meta_query'] = array( array( 'key' => 'eventdate', 'value' => date('Y-m-d'), 'compare' => '>=', 'type' => 'date' ) ); } // ========== END OF EVENTS ONLY QUERY ================= // ========== QUERY BY ID ================= if($id){ $idarr = explode(",",$id); if(count($idarr) > 0){ $quantity = count($idarr); $args = array( 'post__in'=> $idarr, 'orderby' => 'post__in', 'ignore_sticky_posts' => 1 ); } } // ========== QUERY BY ID END ================= /** * [$wp_query execution of the query] * @var WP_Query */ $wp_query = new WP_Query( $args ); /** * Output object start */ ob_start(); if ( $wp_query->have_posts() ) : $numposts = $wp_query->found_posts; $slides = $quantity; $cols = 12 / $slides; ?>
esc_html__( "Slideshow Fullscreen", "vlogger" ), "base" => "qt-slideshowfullscreen", "icon" => get_template_directory_uri(). '/img/slideshow-fullscreen.png', "description" => esc_html__( "Slideshow of post or custom posts", "vlogger" ), "category" => esc_html__( "Theme shortcodes", "vlogger"), "params" => array( array( "type" => "textfield", "heading" => esc_html__( "ID, comma separated list (123,345,7638)", "vlogger" ), "description" => esc_html__( "Display only the contents with these IDs. All other parameters will be ignored.", "vlogger" ), "param_name" => "id", 'value' => '' ), array( "type" => "dropdown", "heading" => esc_html__( "Post type", "vlogger" ), "param_name" => "posttype", 'value' => array("post", "page", "vlogger_serie"), "description" => esc_html__( "Number of posts to display", "vlogger" ) ), array( "type" => "dropdown", "heading" => esc_html__( "Quantity", "vlogger" ), "param_name" => "quantity", 'value' => array(1, 2, 3, 4, 6), "description" => esc_html__( "Number of posts to display", "vlogger" ) ), array( "type" => "textfield", "heading" => esc_html__( "Filter by category (slug)", "vlogger" ), "description" => esc_html__("Instert the slug of a category to filter the results","vlogger"), "param_name" => "category" ), array( "type" => "textfield", "heading" => esc_html__( "Offset (number)", "vlogger" ), "description" => esc_html__("Number of posts to skip in the database query","vlogger"), "param_name" => "offset" ) ) ) ); }}