'', 'thumb_height' => '', 'order' => 'ASC', 'show' => 6, 'desc' => true, 'orderby' => 'modified', 'select' => 'all', 'autoslide' => 0, 'cats' => array() ); /* Widget setup */ function __construct() { /* Widget settings. */ $widget_ops = array( 'description' => __( 'A widget with catalog', LANGUAGE_ZONE ) ); /* Create the widget. */ parent::__construct( 'dt-catalog-widget', DT_WIDGET_PREFIX . __( 'Catalog', LANGUAGE_ZONE ), $widget_ops ); } /* Display the widget */ function widget( $args, $instance ) { extract( $args ); $instance = wp_parse_args( (array) $instance, $this->dt_defaults ); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title'] ); $autoslide = $instance['autoslide']; $autoslide_on = $autoslide ? 1 : 0; $h = 130; if ( $instance['thumb_height'] ) { $h = $instance['thumb_height']; } $args = array( 'no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_catalog', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array( array( 'taxonomy' => 'dt_catalog_category', 'field' => 'id', 'terms' => $instance['cats'] ) ), ); switch( $instance['select'] ) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset( $args['tax_query'] ); } add_filter('posts_clauses', 'dt_core_join_left_filter'); $p_query = new WP_Query( $args ); remove_filter('posts_clauses', 'dt_core_join_left_filter'); // caching! if ( $p_query->have_posts() ) { $images = array(); foreach ( $p_query->posts as $p ) { if ( has_post_thumbnail( $p->ID ) ) { $images[] = get_post_thumbnail_id( $p->ID ); } } if ( $images ) { $i_query = new WP_Query( array( 'no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'orderby' => 'menu_order', 'post__in' => $images ) ); } } echo $before_widget ; // start echo $before_title . $title . $after_title; ?> dt_defaults ); $p_orderby = array( 'ID' => _x( 'Order by ID', 'backend orderby', LANGUAGE_ZONE ), 'author' => _x( 'Order by author', 'backend orderby', LANGUAGE_ZONE ), 'title' => _x( 'Order by title', 'backend orderby', LANGUAGE_ZONE ), 'date' => _x( 'Order by date', 'backend orderby', LANGUAGE_ZONE ), 'modified' => _x( 'Order by modified', 'backend orderby', LANGUAGE_ZONE ), 'rand' => _x( 'Order by rand', 'backend orderby', LANGUAGE_ZONE ), 'menu_order'=> _x( 'Order by menu', 'backend orderby', LANGUAGE_ZONE ) ); ?>


1, 'hierarchical' => false ) ); if( !is_wp_error($terms) ): ?>

get_field_name( 'select' ), $instance['select'], array( 'all' => array( 'desc' => __('All', LANGUAGE_ZONE) ), 'only' => array( 'desc' => __('Only', LANGUAGE_ZONE) ), 'except' => array( 'desc' => __('Except', LANGUAGE_ZONE) ) ) ); ?>
term_id, $instance['cats']) ); ?>/>

/>

milliseconds
(1 second = 1000 milliseconds; to disable autoslide leave this field blank or set it to "0")