'ampforwp_categories_widget', 'description' => esc_html__('This Widget adds categories where necessary in AMP Pages','accelerated-mobile-pages') ); parent::__construct( 'ampforwp_categories_widget', esc_html__('AMP Categories Module','accelerated-mobile-pages'), $widget_options ); } // args for the output of the form public $args = array( 'id' => 'uniqueid', 'before_title' => '

', 'after_title' => '

', 'before_widget' => '
', 'after_widget' => '
' ); // Create the widget output. public function widget( $args, $instance ) { $ampforwp_title = apply_filters( 'widget_title', $instance[ 'title' ] ); $ampforwp_category_count = $instance[ 'count' ]; $ampforwp_category_id = $instance[ 'category' ]; $ampforwp_category_link = $instance[ 'showButton' ]; $ampforwp_show_excerpt = $instance[ 'showExcerpt' ]; global $redux_builder_amp; // echo . $args['before_title'] . . $args['after_title']; ?> $ampforwp_category_id, 'posts_per_page' => $ampforwp_category_count, 'post__not_in' => $exclude_ids, 'has_password' => false, 'post_status'=> 'publish' ); // The Query $the_query = new WP_Query( $args ); $thumb_url = ""; // The Loop if ( $the_query->have_posts() ) { echo '
'; } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata(); // echo $args['after_widget']; } // Create the admin area widget settings form. public function form( $instance ) { // Declarations for all the values to be stored $ampforwp_title = ! empty( $instance['title'] ) ? $instance['title'] : 'Category Title'; $selected_category = ! empty( $instance['category'] ) ? $instance['category'] : ''; $ampforwp_category_count = ! empty( $instance['count'] ) ? $instance['count'] : 3 ; $radio_buttons = ! empty( $instance['showButton'] ) ? $instance['showButton'] : 'yes'; $excerpt_buttons = ! empty( $instance['showExcerpt'] ) ? $instance['showExcerpt'] : 'yes'; ?>