__( 'select this widget to display the latest project', 'vssgroup_wpb_widget_domain' ), ) ); } // Creating widget front-end // This is where the action happens public function widget( $args, $instance ) { $vssgroup_title_text = sanitize_text_field( $instance['vssgroup_title'] ); $vssgroup_pcount_text = sanitize_text_field( $instance['vssgroup_pcount'] ); $vssgroup_title = apply_filters( 'widget_title', $vssgroup_title_text ); $vssgroup_pcount = apply_filters( 'portfolio_count', $vssgroup_pcount_text ); // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $vssgroup_title ) ) echo $args['before_title'] . $vssgroup_title . $args['after_title']; // This is where you run the code and display the output ?>
$page, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'portfolio', 'posts_per_page' => $vssgroup_pcount, 'post_status' => 'publish'); $query = new WP_Query($args); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?> max_num_pages); } ?>