'AMPFORWP_Woo_Widget',
'description' => esc_html__('This Widget adds Woocommerce Products where necessary in AMP Pages','accelerated-mobile-pages')
);
parent::__construct( 'AMPFORWP_Woo_Widget', esc_html__('AMP WooCommerce','accelerated-mobile-pages'), $widget_options );
}
// args for the output of the form
public $args = array(
'before_title' => '
',
'before_widget' => '',
'after_widget' => '
'
);
// Create the widget output.
public function widget( $args,$instance ) {
// initializing these to avoid debug errors
global $redux_builder_amp;
global $woocommerce;
if( !class_exists( 'WooCommerce' ) ){
return;
}
$ampforwp_title = apply_filters( 'widget_wc_title', $instance[ 'title' ] );
$ampforwp_enable_ratings = $instance[ 'ratings' ];
$on_sale_logo_on_product = $instance[ 'on_sale' ];
$ampforwp_procts_page_link = $instance[ 'link' ];
$ampforwp_number_of_products = $instance[ 'num_of_products' ];
$ampforwp_show_price = $instance[ 'show_price' ];
$exclude_ids = ampforwp_exclude_posts();
$q = new WP_Query( array(
'post_type' => 'product',
'orderby' => 'date',
'post__not_in' => $exclude_ids,
'has_password' => false,
'post_status' => 'publish',
'posts_per_page' => esc_attr( $ampforwp_number_of_products )
) );
echo '';
echo '