__( 'select this widget to display the latest project', 'wpb_widget_domain' ), ) ); } // Creating widget front-end // This is where the action happens public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $pcount = apply_filters( 'portfolio_count', $instance['pcount'] ); // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $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' => $pcount, 'post_status' => 'publish'); $query = new WP_Query($args); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?> max_num_pages); } ?>