defaults = array( 'title' => '', 'post_number' => 4, 'title_length' => 0, ); parent::__construct( 'digimag-video-posts', esc_html__( 'Digimag: Video Posts', 'digimag-lite' ), array( 'classname' => 'digimag-video-posts is-hidden', 'description' => esc_html__( 'A widget that displays your post format video', 'digimag-lite' ), ) ); } /** * Widget form. * * @param array $instance Widget instance. * * @return void */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->defaults ); $title = sanitize_text_field( $instance['title'] ); $post_number = absint( $instance['post_number'] ); $title_length = intval( $instance['title_length'] ); ?>

defaults ); $title = $instance['title']; $post_number = $instance['post_number']; $title_length = $instance['title_length']; $arguments = array( 'pots_type' => 'post', 'posts_per_page' => $post_number, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-video', ), ), ); $format_link = get_post_format_link( 'video' ); $query = new WP_Query( $arguments ); if ( $query->have_posts() ) { echo $args['before_widget']; // WPCS: XSS OK. ?>
have_posts() ) : $query->the_post(); ?>
">
Video', esc_url( $format_link ) ); ?>