'optimizer_front_posts postsblck', 'description' => __( 'This Widget lets you display WordPress Posts, Pages and Woocommerce Products.', 'optimizer' ), 'customize_selective_refresh' => true, ) ); $this->alt_option_name = 'optimizer_front_posts'; add_action('wp_enqueue_scripts', array(&$this, 'optimizer_posts_enqueue_css')); } /* ---------------------------- */ /* ------- Display Widget -------- */ /* ---------------------------- */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = isset( $instance['title'] ) ? wp_kses_post($instance['title']) : __('Our Work', 'optimizer'); $subtitle = isset( $instance['subtitle'] ) ? wp_kses_post($instance['subtitle']) : __('Check Out Our Portfolio', 'optimizer'); $layout = isset( $instance['layout'] ) ? absint($instance['layout']) : '1'; $type = isset( $instance['type'] ) ? esc_attr($instance['type']) : 'post'; $count = isset( $instance['count'] ) ? absint($instance['count']) : '6'; $category = isset( $instance['category'] ) ? $instance['category'] : array(); $divider = isset( $instance['divider'] ) ? apply_filters('widget_title', $instance['divider'], $this->id_base) : 'fa-stop'; $navigation = isset( $instance['navigation'] ) ? esc_html($instance['navigation']) : 'numbered'; $postbgcolor = isset( $instance['postbgcolor'] ) ? esc_html($instance['postbgcolor']) : ''; $titlecolor = isset( $instance['titlecolor'] ) ? esc_html($instance['titlecolor']) : ''; $secbgcolor = isset( $instance['secbgcolor'] ) ? esc_html($instance['secbgcolor']) : ''; /* Before widget (defined by themes). */ echo $before_widget; if(is_customize_preview()) echo ''; //THE QUERY if(!empty($category) && $type == 'post'){ $blogcat = array_map( 'esc_html', $category ); $blogcats =implode(',', $blogcat); }else{ $blogcats = ''; } echo '
" type="text" />
" type="text" />
option_name); if ( empty( $settings ) ) { return; } foreach ( $settings as $instance_id => $instance ) { $id = $this->id_base . '-' . $instance_id; if ( ! is_active_widget( false, $id, $this->id_base ) ) { continue; } $postbgcolor = ''; $titlecolor = '#333333;'; $secbgcolor = 'background-color:#ffffff;'; if ( ! empty( $instance['layout'] ) ) {$layout = esc_html($instance['layout']); }else{$layout = '1';} if ( ! empty( $instance['postbgcolor'] ) ) { $postbgcolor = 'background-color: ' . esc_html($instance['postbgcolor']) . '; '; } if ( ! empty( $instance['titlecolor'] ) ) { $titlecolor = $instance['titlecolor'] . '; '; } if ( ! empty( $instance['secbgcolor'] ) ) { $secbgcolor = 'background-color: ' . esc_html($instance['secbgcolor']) . '; '; } $widget_style = '#'.$id.' .lay'.$layout.' .hentry{ '.$postbgcolor.' }#'.$id.' .lay'.$layout.'{ '.$secbgcolor.' }#'.$id.' .lay'.$layout.' .home_title, #'.$id.' .lay'.$layout.' .home_subtitle, #'.$id.' span.div_middle{color:'.$titlecolor.' }#'.$id.' span.div_left, #'.$id.' span.div_right{background-color:' . $titlecolor . '}'; wp_add_inline_style( 'optimizer-style', $widget_style ); } } } ?>