esc_html__( 'Right Sidebar', 'estore' ),
'id' => 'estore_sidebar_right',
'description' => '',
'before_widget' => '',
'before_title' => '
'
) );
// Registering Left Sidebar
register_sidebar( array(
'name' => esc_html__( 'Left Sidebar', 'estore' ),
'id' => 'estore_sidebar_left',
'description' => '',
'before_widget' => '',
'before_title' => ''
) );
// Register Header Right Sidebar
register_sidebar( array(
'name' => esc_html__( 'Header Right Sidebar', 'estore' ),
'id' => 'estore_sidebar_header',
'description' => '',
'before_widget' => '',
'before_title' => ''
) );
// Register Slider Sidebar
register_sidebar( array(
'name' => esc_html__( 'Front Page: Slider Area', 'estore' ),
'id' => 'estore_sidebar_slider',
'description' => '',
'before_widget' => '',
'before_title' => ''
) );
// Register Area beside slider Sidebar
register_sidebar( array(
'name' => esc_html__( 'Front Page: Area beside Slider', 'estore' ),
'id' => 'estore_sidebar_slider_beside',
'description' => '',
'before_widget' => '',
'before_title' => ''
) );
// Register Front Page Sidebar
register_sidebar( array(
'name' => esc_html__( 'Front Page Sidebar', 'estore' ),
'id' => 'estore_sidebar_front',
'description' => '',
'before_widget' => '',
'before_title' => ''
) );
// Footer Widgets
$footer_sidebar_count = get_theme_mod('estore_footer_widgets', '4');
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 1', 'estore' ),
'id' => 'estore_footer_sidebar1',
'description' => esc_html__( 'Show widgets at Footer section', 'estore' ),
'before_widget' => '',
'before_title' => '',
) );
if ( $footer_sidebar_count >= 2 ) {
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 2', 'estore' ),
'id' => 'estore_footer_sidebar2',
'description' => esc_html__( 'Show widgets at Footer section', 'estore' ),
'before_widget' => '',
'before_title' => '',
) );
}
if ( $footer_sidebar_count >= 3 ) {
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 3', 'estore' ),
'id' => 'estore_footer_sidebar3',
'description' => esc_html__( 'Show widgets at Footer section', 'estore' ),
'before_widget' => '',
'before_title' => '',
) );
}
if ($footer_sidebar_count >= 4 ) {
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 4', 'estore' ),
'id' => 'estore_footer_sidebar4',
'description' => esc_html__( 'Show widgets at Footer section', 'estore' ),
'before_widget' => '',
'before_title' => '',
) );
}
// Widgets Registration
register_widget( "estore_728x90_ad" );
register_widget( "estore_about" );
register_widget( "estore_featured_posts_widget" );
register_widget( "estore_logo_widget" );
register_widget( "estore_featured_posts_slider_widget" );
register_widget( "estore_featured_posts_carousel_widget" );
register_widget( "estore_posts_grid" );
register_widget( "estore_vertical_promo_widget" );
register_widget( "estore_full_width_promo_widget" );
}
// 728 X 90 Advertisement Widget
class estore_728x90_ad extends WP_Widget {
function __construct() {
$widget_ops = array(
'classname' => 'widget_image_with_link',
'description' => esc_html__( 'Add your Advertisement here', 'estore')
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name= esc_html__( 'TG: Advertisement', 'estore' ),$widget_ops);
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', '728x90_image_url' => '', '728x90_image_link' => '') );
$title = esc_attr( $instance[ 'title' ] );
$image_link = '728x90_image_link';
$image_url = '728x90_image_url';
$instance[ $image_link ] = esc_url( $instance[ $image_link ] );
$instance[ $image_url ] = esc_url( $instance[ $image_url ] );
?>
get_field_id( $instance[ $image_url ] . 'preview') . '"src="' . $instance[ $image_url ] . '"style="max-width:250px;" />
';
endif;
?>
id, $image_url );
icl_register_string( 'eStore', 'TG: Advertisement Image Link' . $this->id, $image_link );
}
if ( function_exists( 'icl_t' ) ) {
$image_url = icl_t( 'eStore', 'TG: Advertisement Image'. $this->id, $image_url );
$image_link = icl_t( 'eStore', 'TG: Advertisement Image Link'. $this->id, $image_link );
}
echo $before_widget; ?>
';
if ( !empty( $image_link ) ) {
$output .= '
';
} else {
$output .= '
.')
';
}
$output .= '
';
echo $output;
} ?>
'widget-about clearfix',
'description' => esc_html__( 'Show your about page. Suitable for Click to Action.', 'estore' )
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: About Widget', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
$defaults[ 'title' ] = '';
$defaults[ 'page_id' ] = '';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$page_id = absint( $instance[ 'page_id' ] );
?>
' ',
'name' => $this->get_field_name( 'page_id' ),
'selected' => $instance[ 'page_id' ]
) );
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance[ 'title' ] = sanitize_text_field( $new_instance[ 'title' ] );
$instance[ 'page_id' ] = absint( $new_instance[ 'page_id' ] );
return $instance;
}
function widget( $args, $instance ) {
extract( $args );
extract( $instance );
global $post;
$title = apply_filters( 'widget_title', isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : '');
$page_id = isset( $instance[ 'page_id' ] ) ? $instance[ 'page_id' ] : '';
echo $before_widget; ?>
have_posts() ):$the_query->the_post();
$title_attribute = the_title_attribute( 'echo=0' );
$output = '
';
$output .= '
'. get_the_title() .'
';
$output .= '
' . get_the_excerpt() . '
';
$output .= '
';
echo $output;
?>
'widget_full_width_promo widget-collection-thumb clearfix"',
'description' => esc_html__( 'Display WooCommerce Product Categories with featured image in horizontal layout.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Horizontal Promo WC Category', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
for ( $i=0; $i<3; $i++ ) {
$var = 'cat_id'.$i;
$defaults[$var] = '';
}
$instance = wp_parse_args( (array) $instance, $defaults );
for ( $i=0; $i<3; $i++ ) {
$var = 'cat_id'.$i;
$var = absint( $instance[ $var ] );
}
for( $i=0; $i<3; $i++) { ?>
' ',
'name' => $this->get_field_name( 'cat_id'.$i ),
'selected' => $instance['cat_id'.$i],
'taxonomy' => 'product_cat'
)
);
?>
'product_cat',
'orderby' => 'date',
'hide_empty' => '0',
'include' => $cat_array
);
echo $before_widget; ?>
term_id;
$cat_link = get_category_link( $cat_id );
?>
'widget_full_width_promo widget-collection-thumb clearfix"',
'description' => esc_html__( 'Display some pages with featured image in horizontal layout.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Horizontal Promo', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
for ( $i=0; $i<3; $i++ ) {
$var = 'page_id'.$i;
$defaults[$var] = '';
}
$instance = wp_parse_args( (array) $instance, $defaults );
for ( $i=0; $i<3; $i++ ) {
$var = 'page_id'.$i;
$var = absint( $instance[ $var ] );
}
for( $i=0; $i<3; $i++) { ?>
' ',
'name' => $this->get_field_name( key($defaults) ),
'selected' => $instance[ key($defaults) ]
) );
?>
3,
'post_type' => array( 'page' ),
'post__in' => $page_array,
) );
echo $before_widget; ?>
have_posts() ):$get_featured_pages->the_post();
if( !has_post_thumbnail() )
return;
?>
'widget_vertical_promo collection-wrapper clearfix"',
'description' => esc_html__( 'Display WooCommerce Product Categories in vertical layout with featured image.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Vertical Promo WC Category', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
for ( $i=0; $i<2; $i++ ) {
$var = 'cat_id'.$i;
$defaults[$var] = '';
}
$instance = wp_parse_args( (array) $instance, $defaults );
for ( $i=0; $i<2; $i++ ) {
$var = 'cat_id'.$i;
$var = absint( $instance[ $var ] );
}
for( $i=0; $i<2; $i++) { ?>
' ',
'name' => $this->get_field_name( key($defaults) ),
'selected' => $instance[key($defaults)],
'taxonomy' => 'product_cat'
)
);
?>
'product_cat',
'orderby' => 'date',
'hide_empty' => '0',
'include' => $cat_array
);
echo $before_widget; ?>
term_id;
$cat_link = get_category_link( $cat_id );
?>
term_id, 'thumbnail_id', true );
//$image = wp_get_attachment_url( $thumbnail_id );
$image = wp_get_attachment_image_src( $thumbnail_id, 'estore-featured-image');
if ( $image[0] ) {
echo '
';
}
// @todo: Default Place holder image needed
?>
'widget_vertical_promo collection-wrapper clearfix"',
'description' => esc_html__( 'Display some pages in vertical layout with featured image.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Vertical Promo', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
for ( $i=0; $i<2; $i++ ) {
$var = 'page_id'.$i;
$defaults[$var] = '';
}
$instance = wp_parse_args( (array) $instance, $defaults );
for ( $i=0; $i<2; $i++ ) {
$var = 'page_id'.$i;
$var = absint( $instance[ $var ] );
}
for( $i=0; $i<2; $i++) { ?>
' ',
'name' => $this->get_field_name( key($defaults) ),
'selected' => $instance[ key($defaults) ]
) );
?>
2,
'post_type' => array( 'page' ),
'post__in' => $page_array,
) );
echo $before_widget; ?>
have_posts() ):$get_featured_pages->the_post();
if( !has_post_thumbnail() )
return;
?>
ID, 'estore-featured-image' ); ?>
'widget-featured-collection featured-collection-color clearfix',
'description' => esc_html__( 'Show WooCommerce Featured Products Carousel.', 'estore' )
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Products Carousel', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
$defaults[ 'title' ] = '';
$defaults[ 'subtitle' ] = '';
$defaults[ 'source' ] = '';
$defaults[ 'category' ] = '';
$defaults[ 'product_number' ] = 10;
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$subtitle = esc_textarea( $instance[ 'subtitle' ] );
$source = $instance[ 'source' ];
$category = absint( $instance[ 'category' ] );
$product_number = absint( $instance[ 'product_number' ] );
?>
'',
'name' => $this->get_field_name( 'category' ),
'selected' => $instance['category'],
'taxonomy' => 'product_cat'
)
);
?>
id, $subtitle );
}
if ( function_exists( 'icl_t' ) ) {
$subtitle = icl_t( 'eStore', 'TG: Product Carousel Subtitle'. $this->id, $subtitle );
}
if ( $source == 'featured' ) {
$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' => 'yes',
'posts_per_page' => $product_number
);
} elseif ( $source == 'sale' ) {
$args = array(
'post_type' => 'product',
'meta_query' => array(
'relation' => 'OR',
array( // Simple products type
'key' => '_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
),
array( // Variable products type
'key' => '_min_variation_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'numeric'
)
),
'posts_per_page' => $product_number
);
} elseif ( $source == 'category' ){
$args = array(
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $category
)
),
'posts_per_page' => $product_number
);
} else {
$args = array(
'post_type' => 'product',
'posts_per_page' => $product_number
);
}
echo $before_widget; ?>
have_posts()) :
$featured_query->the_post();
$product = get_product( $featured_query->post->ID ); ?>
-
is_on_sale() ) : ?>
' . esc_html__( 'Sale!', 'estore' ) . '
', $post, $product ); ?>
get_rating_count();
$average = $product->get_average_rating(); ?>
get_price_html() ) : ?>
id );
?>
'widget-collection clearfix',
'description' => esc_html__( 'Show WooCommerce Featured Products Grid.', 'estore' )
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Product Grid', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
$defaults[ 'title' ] = '';
$defaults[ 'subtitle' ] = '';
$defaults[ 'category'] = '';
$defaults[ 'product_number' ] = 10;
$defaults[ 'cat_image_url' ] = '';
$defaults[ 'cat_image_link' ] = '';
$defaults[ 'align' ] = 'collection-left-align';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$subtitle = esc_textarea( $instance[ 'subtitle' ] );
$cat_image_url = esc_url( $instance[ 'cat_image_url' ] );
$cat_image_link = esc_url( $instance[ 'cat_image_link' ] );
$align = $instance[ 'align' ];
$category = absint( $instance[ 'category' ] );
$product_number = absint( $instance[ 'product_number' ] );
?>
get_field_id( $instance[ 'cat_image_url' ] . 'preview') . '"src="' . $instance[ 'cat_image_url' ] . '"style="max-width:250px;" />
';
endif;
?>
id="get_field_id( 'align' ); ?>" name="get_field_name( 'align' ); ?>" value="collection-right-align" />
id="get_field_id( 'align' ); ?>" name="get_field_name( 'align' ); ?>" value="collection-left-align" />
'',
'name' => $this->get_field_name( 'category' ),
'selected' => $instance['category'],
'taxonomy' => 'product_cat'
)
);
?>
id, $subtitle );
icl_register_string( 'eStore', 'TG: Product Grid Image' . $this->id, $cat_image_url );
icl_register_string( 'eStore', 'TG: Product Grid Image Link' . $this->id, $cat_image_link );
}
if ( function_exists( 'icl_t' ) ) {
$subtitle = icl_t( 'eStore', 'TG: Product Grid Subtitle'. $this->id, $subtitle );
$cat_image_url = icl_t( 'eStore', 'TG: Product Grid Image'. $this->id, $cat_image_url );
$cat_image_link = icl_t( 'eStore', 'TG: Product Grid Image Link'. $this->id, $cat_image_link );
}
$args = array(
'post_type' => 'product',
'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $category
)
),
'posts_per_page' => $product_number
);
echo $before_widget; ?>
.')
';
} else {
$output .= '
.')
';
}
echo $output;
} ?>
have_posts()) :
$featured_query->the_post();
$product = get_product( $featured_query->post->ID );
if($count == 1){ ?>
post, $product ); ?>
get_price_html() ) : ?>
is_on_sale() ) : ?>
' . esc_html__( 'Sale!', 'estore' ) . ' ', $post, $product ); ?>
get_rating_count();
$average = $product->get_average_rating(); ?>
id );
?>
1 && $count < 7 || $count > 6) { ?>
get_price_html() ) : ?>
id );
?>
post, $product );
?>
'widget_featured_posts_block blog-section',
'description' => esc_html__( 'Display latest posts or posts of specific category', 'estore')
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name= esc_html__( 'TG: Featured Posts', 'estore' ),$widget_ops);
}
function form( $instance ) {
$defaults[ 'title' ] = '';
$defaults[ 'number' ] = 3;
$defaults[ 'type' ] = 'latest';
$defaults[ 'category' ] = '';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$number = absint( $instance[ 'number' ] );
$type = $instance[ 'type' ];
$category = $instance[ 'category' ];
?>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>
' ','name' => $this->get_field_name( 'category' ), 'selected' => $category ) ); ?>
$number,
'post_type' => 'post',
'ignore_sticky_posts' => true
) );
}
else {
$get_featured_posts = new WP_Query( array(
'posts_per_page' => $number,
'post_type' => 'post',
'category__in' => $category
) );
}
echo $before_widget; ?>
have_posts() ):$get_featured_posts->the_post(); ?>
>
%2$s';
$time_string = printf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date( 'M j' ) ),
esc_html( esc_url( get_the_permalink() ) ),
esc_html( the_title_attribute('echo=0') )
);
?>
' width="380" height="250" />
', ', ', '' );
if ( $tags_list ) echo $tags_list;
?>
'widget_logo clearfix',
'description' => esc_html__( 'Add your clients/brand logo images here', 'estore')
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name= esc_html__( 'TG: Logo', 'estore' ),$widget_ops);
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance,
array(
'title' => '',
'logo_image1' => '',
'logo_link1' => '',
'logo_image2' => '',
'logo_link2' => '',
'logo_image3' => '',
'logo_link3' => '',
'logo_image4' => '',
'logo_link4' => '',
'logo_image5' => '',
'logo_link5' => '',
)
);
$title = esc_attr( $instance[ 'title' ] );
for ( $i = 1; $i < 6; $i++ ) {
$image_link = 'logo_link'.$i;
$image_url = 'logo_image'.$i;
$instance[ $image_link ] = esc_url( $instance[ $image_link ] );
$instance[ $image_url ] = esc_url( $instance[ $image_url ] );
}
?>
get_field_id( $instance[ $image_url ] . 'preview') . '"src="' . $instance[ $image_url ] . '"style="max-width:250px;" />
';
endif;
?>
id.$j, $image_array[$j] );
icl_register_string( 'eStore', 'TG: Logo Link' . $this->id.$j, $link_array[$j] );
}
$j++;
}
echo $before_widget; ?>
';
for ( $i = 1; $i < 6; $i++ ) {
$j = $i - 1;
if( !empty( $image_array[$j] ) ) {
$output .= '
';
// For Multilingual compatibility
if ( function_exists( 'icl_t' ) ) {
$image_array[$j] = icl_t( 'eStore', 'TG: Logo Image' . $this->id . $j , $image_array[$j] );
}
if( !empty( $link_array[$j] ) ) {
if ( function_exists( 'icl_t' ) ) {
$link_array[$j] = icl_t( 'eStore', 'TG: Logo Link' . $this->id . $j , $link_array[$j] );
}
$output .= '
.')
';
} else {
$output .= '
.')
';
}
$output .= '
';
}
}
$output .= '
';
echo $output;
}
?>
'slider_wrapper category-slider clearfix',
'description' => esc_html__( 'Display latest posts or posts of specific category, which will be used as the slider.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name= esc_html__( 'TG: Category Slider', 'estore' ), $widget_ops);
}
function form( $instance ) {
$tg_defaults['number'] = 4;
$tg_defaults['type'] = 'latest';
$tg_defaults['category'] = '';
$instance = wp_parse_args( (array) $instance, $tg_defaults );
$number = $instance['number'];
$type = $instance['type'];
$category = $instance['category'];
?>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>
' ',
'name' => $this->get_field_name( 'category' ),
'selected' => $category
)
);
?>
$number,
'post_type' => 'post',
'ignore_sticky_posts' => true
) );
}
else {
$get_featured_posts = new WP_Query( array(
'posts_per_page' => $number,
'post_type' => 'post',
'category__in' => $category
) );
}
echo $before_widget;
?>
have_posts() ):
$get_featured_posts->the_post();
if( has_post_thumbnail() ) { ?>
-
ID );
the_post_thumbnail( $post->ID, 'estore-slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) );
?>
'slider_wrapper product-slider clearfix',
'description' => esc_html__( 'Display WooCommerce Product from category.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name = esc_html__( 'TG: Product Slider', 'estore' ), $widget_ops);
}
function form( $instance ) {
$tg_defaults['number'] = 4;
$tg_defaults['type'] = 'latest';
$tg_defaults['category'] = '';
$instance = wp_parse_args( (array) $instance, $tg_defaults );
$number = $instance['number'];
$type = $instance['type'];
$category = $instance['category'];
?>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>
'',
'name' => $this->get_field_name( 'category' ),
'selected' => $instance['category'],
'taxonomy' => 'product_cat'
)
);
?>
$number,
'post_type' => 'product',
'ignore_sticky_posts' => true
) );
}
else {
$get_featured_posts = new WP_Query( array(
'post_type' => 'product',
'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $category
)
),
'posts_per_page' => $number
) );
}
echo $before_widget;
?>
have_posts() ):
$get_featured_posts->the_post();
if( has_post_thumbnail() ) {
?>
-
'slider_wrapper widget-featured-collection clearfix',
'description' => esc_html__( 'Display latest posts or posts of specific category, which will be used as the carousel.', 'estore' ) );
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false,$name= esc_html__( 'TG: Category Carousel', 'estore' ), $widget_ops);
}
function form( $instance ) {
$tg_defaults[ 'title' ] = '';
$tg_defaults[ 'subtitle' ] = '';
$tg_defaults['number'] = 5;
$tg_defaults['type'] = 'latest';
$tg_defaults['category'] = '';
$instance = wp_parse_args( (array) $instance, $tg_defaults );
$title = esc_attr( $instance[ 'title' ] );
$subtitle = esc_textarea( $instance[ 'subtitle' ] );
$number = $instance['number'];
$type = $instance['type'];
$category = $instance['category'];
?>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="latest"/>
id="get_field_id( 'type' ); ?>" name="get_field_name( 'type' ); ?>" value="category"/>
' ',
'name' => $this->get_field_name( 'category' ),
'selected' => $category
)
);
?>
$number,
'post_type' => 'post',
'ignore_sticky_posts' => true
) );
}
else {
$get_featured_posts = new WP_Query( array(
'posts_per_page' => $number,
'post_type' => 'post',
'category__in' => $category
) );
}
// For Multilingual compatibility
if ( function_exists( 'icl_register_string' ) ) {
icl_register_string( 'eStore', 'TG: Category Carousel Subtitle' . $this->id, $subtitle );
}
if ( function_exists( 'icl_t' ) ) {
$subtitle = icl_t( 'eStore', 'TG: Category Carousel Subtitle'. $this->id, $subtitle );
}
echo $before_widget;
?>
have_posts()) :
$get_featured_posts->the_post(); ?>
-
'widget-collection clearfix',
'description' => esc_html__( 'Show Featured Category Posts in Grid Layout.', 'estore' )
);
$control_ops = array(
'width' => 200,
'height' => 250
);
parent::__construct( false, $name = esc_html__( 'TG: Category Grid', 'estore' ), $widget_ops, $control_ops);
}
function form( $instance ) {
$defaults[ 'title' ] = '';
$defaults[ 'subtitle' ] = '';
$defaults[ 'category'] = '';
$defaults[ 'post_number' ] = 10;
$defaults[ 'cat_image_url' ] = '';
$defaults[ 'cat_image_link' ] = '';
$defaults[ 'align' ] = 'collection-left-align';
$instance = wp_parse_args( (array) $instance, $defaults );
$title = esc_attr( $instance[ 'title' ] );
$subtitle = esc_textarea( $instance[ 'subtitle' ] );
$cat_image_url = esc_url( $instance[ 'cat_image_url' ] );
$cat_image_link = esc_url( $instance[ 'cat_image_link' ] );
$align = $instance[ 'align' ];
$category = absint( $instance[ 'category' ] );
$post_number = absint( $instance[ 'post_number' ] );
?>
get_field_id( $instance[ 'cat_image_url' ] . 'preview') . '"src="' . $instance[ 'cat_image_url' ] . '"style="max-width:250px;" />
';
endif;
?>
id="get_field_id( 'align' ); ?>" name="get_field_name( 'align' ); ?>" value="collection-right-align" />
id="get_field_id( 'align' ); ?>" name="get_field_name( 'align' ); ?>" value="collection-left-align" />
'',
'name' => $this->get_field_name( 'category' ),
'selected' => $instance['category']
)
);
?>
$post_number,
'post_type' => 'post',
'category__in' => $category
);
// For Multilingual compatibility
if ( function_exists( 'icl_register_string' ) ) {
icl_register_string( 'eStore', 'TG: Category Grid Subtitle' . $this->id, $subtitle );
icl_register_string( 'eStore', 'TG: Category Grid Image' . $this->id, $cat_image_url );
icl_register_string( 'eStore', 'TG: Category Grid Image Link' . $this->id, $cat_image_link );
}
if ( function_exists( 'icl_t' ) ) {
$subtitle = icl_t( 'eStore', 'TG: Category Grid Subtitle'. $this->id, $subtitle );
$cat_image_url = icl_t( 'eStore', 'TG: Category Grid Image'. $this->id, $cat_image_url );
$cat_image_link = icl_t( 'eStore', 'TG: Category Grid Image Link'. $this->id, $cat_image_link );
}
echo $before_widget; ?>
.')
';
} else {
$output .= '
.')
';
}
echo $output;
} ?>
have_posts()) :
$featured_query->the_post();
if($count == 1){ ?>
1 && $count < 7 || $count > 6) { ?>