1028 lines
44 KiB
PHP
1028 lines
44 KiB
PHP
|
<?php
|
||
|
|
||
|
///----footer V1 widgets---
|
||
|
//Recent Posts
|
||
|
class Thinkai_Recent_Posts extends WP_Widget
|
||
|
{
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Recent_Posts', /* Name */esc_html__('Thinkai Recent Posts','thinkai'), array( 'description' => esc_html__('Show the Recent Posts', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
|
||
|
echo wp_kses_post($before_widget); ?>
|
||
|
|
||
|
<div class="single-footer-widget--link-box">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<div class="single-footer-widget__blog-post">
|
||
|
<ul>
|
||
|
<?php $query_string = array('showposts'=>$instance['number']);
|
||
|
if ($instance['cat']) {
|
||
|
$query_string['tax_query'] = array(array('taxonomy' => 'category','field' => 'id','terms' => (array)$instance['cat']));
|
||
|
}
|
||
|
$this->posts($query_string);
|
||
|
?>
|
||
|
</ul>
|
||
|
<?php if($instance[ 'btn_link' ]){ ?>
|
||
|
<div class="btn-box">
|
||
|
<a href="<?php echo esc_url( $instance[ 'btn_link' ] );?>"><span class="icon-right-arrow1"></span><?php echo wp_kses( $instance[ 'btn_title' ], true );?></a>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/* @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['number'] = $new_instance['number'];
|
||
|
$instance['cat'] = $new_instance['cat'];
|
||
|
$instance['btn_title'] = $new_instance['btn_title'];
|
||
|
$instance['btn_link'] = $new_instance['btn_link'];
|
||
|
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/* @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ( $instance ) ? esc_attr($instance['title']) : esc_html__('Recent Post', 'thinkai');
|
||
|
$number = ( $instance ) ? esc_attr($instance['number']) : 2;
|
||
|
$cat = ( $instance ) ? esc_attr($instance['cat']) : '';
|
||
|
$btn_title = ( $instance ) ? esc_attr($instance['btn_title']) : '';
|
||
|
$btn_link = ( $instance ) ? esc_attr($instance['btn_link']) : '';?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('No. of Posts:', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('categories')); ?>"><?php esc_html_e('Category', 'thinkai'); ?></label>
|
||
|
<?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'thinkai'), 'taxonomy' => 'category', 'selected'=>$cat, 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('btn_title')); ?>"><?php esc_html_e('Button Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_title')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_title')); ?>" type="text" value="<?php echo esc_attr( $btn_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('btn_link')); ?>"><?php esc_html_e('Button Link: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_link')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_link')); ?>" type="text" value="<?php echo esc_attr( $btn_link ); ?>" />
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
function posts($query_string)
|
||
|
{
|
||
|
|
||
|
$query = new WP_Query($query_string);
|
||
|
if( $query->have_posts() ):?>
|
||
|
|
||
|
<!-- Title -->
|
||
|
<?php
|
||
|
while ( $query->have_posts() ) : $query->the_post();
|
||
|
?>
|
||
|
<li>
|
||
|
<?php if(has_category()){ ?><div class="category"><?php the_category(''); ?></div><?php } ?>
|
||
|
<h4>
|
||
|
<a href="<?php echo esc_url(get_the_permalink(get_the_id()));?>">
|
||
|
<?php the_title(); ?>
|
||
|
</a>
|
||
|
</h4>
|
||
|
</li>
|
||
|
<?php endwhile; ?>
|
||
|
|
||
|
<?php endif;
|
||
|
wp_reset_postdata();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//Get in Touch
|
||
|
class Thinkai_Get_In_Touch extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Get_In_Touch', /* Name */esc_html__('Thinkai Get in Touch','thinkai'), array( 'description' => esc_html__('Show the Get in Touch', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
echo wp_kses_post($before_widget);
|
||
|
?>
|
||
|
|
||
|
<div class="martop">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<div class="footer-widget-contact-info">
|
||
|
<?php if( $instance['show'] ): ?>
|
||
|
<div class="footer-social-link">
|
||
|
<ul class="clearfix">
|
||
|
<?php echo thinkai_get_social_icon_two();?>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<?php endif; ?>
|
||
|
|
||
|
<div class="text">
|
||
|
<p><?php echo wp_kses( $instance[ 'footer_content' ], true );?></p>
|
||
|
</div>
|
||
|
|
||
|
<?php if($instance[ 'footer_btn_link' ]){ ?>
|
||
|
<div class="btn-box">
|
||
|
<a href="<?php echo esc_url( $instance[ 'footer_btn_link' ] );?>"><span class="icon-chat"></span> <?php echo wp_kses( $instance[ 'footer_btn_title' ], true );?></a>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['footer_content'] = $new_instance['footer_content'];
|
||
|
$instance['footer_btn_title'] = $new_instance['footer_btn_title'];
|
||
|
$instance['footer_btn_link'] = $new_instance['footer_btn_link'];
|
||
|
$instance['show'] = $new_instance['show'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ($instance) ? esc_attr($instance['title']) : '';
|
||
|
$footer_content = ($instance) ? esc_attr($instance['footer_content']) : '';
|
||
|
$footer_btn_title = ($instance) ? esc_attr($instance['footer_btn_title']) : '';
|
||
|
$footer_btn_link = ($instance) ? esc_attr($instance['footer_btn_link']) : '';
|
||
|
$show = ($instance) ? esc_attr($instance['show']) : '';
|
||
|
?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_content')); ?>"><?php esc_html_e('Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_content')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_content')); ?>" ><?php echo wp_kses_post($footer_content); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_btn_title')); ?>"><?php esc_html_e('Button Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_btn_title')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_btn_title')); ?>" type="text" value="<?php echo esc_attr( $footer_btn_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_btn_link')); ?>"><?php esc_html_e('Button Link: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_btn_link')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_btn_link')); ?>" type="text" value="<?php echo esc_attr( $footer_btn_link ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('show')); ?>"><?php esc_html_e('Show Social Icons:', 'thinkai'); ?></label>
|
||
|
<?php $selected = ( $show ) ? ' checked="checked"' : ''; ?>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('show')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show')); ?>" type="checkbox" value="true" />
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
///----footer V2 widgets---
|
||
|
//Have any Question
|
||
|
class Thinkai_Have_any_Question extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Have_any_Question', /* Name */esc_html__('Thinkai Have any Question','thinkai'), array( 'description' => esc_html__('Show the Have any Question', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
echo wp_kses_post($before_widget);
|
||
|
?>
|
||
|
|
||
|
<div class="martop">
|
||
|
<div class="footer-widget-contact-info-style2">
|
||
|
<?php if($instance[ 'footer_widget_title' ]){ ?>
|
||
|
<div class="footer-widget-contact-info-style2-top">
|
||
|
<div class="icon-box">
|
||
|
<span class="icon-chat-1"></span>
|
||
|
</div>
|
||
|
<div class="title-box">
|
||
|
<h3><?php echo wp_kses( $instance[ 'footer_widget_title' ], true );?></h3>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
|
||
|
<h2><a href="mailto:<?php echo esc_attr( $instance[ 'footer_widget_email' ]);?>"><?php echo wp_kses( $instance[ 'footer_widget_email' ], true );?></a></h2>
|
||
|
|
||
|
<?php if( $instance['show_v2'] ): ?>
|
||
|
<div class="footer-social-link-style2">
|
||
|
<?php if($instance[ 'footer_social_icon_title' ]){ ?>
|
||
|
<div class="title-box">
|
||
|
<h3><?php echo wp_kses( $instance[ 'footer_social_icon_title' ], true );?></h3>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
<ul class="clearfix">
|
||
|
<?php echo thinkai_get_social_icon_three();?>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<?php endif; ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['footer_widget_title'] = $new_instance['footer_widget_title'];
|
||
|
$instance['footer_widget_email'] = $new_instance['footer_widget_email'];
|
||
|
$instance['footer_social_icon_title'] = $new_instance['footer_social_icon_title'];
|
||
|
$instance['show_v2'] = $new_instance['show_v2'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$footer_widget_title = ($instance) ? esc_attr($instance['footer_widget_title']) : '';
|
||
|
$footer_widget_email = ($instance) ? esc_attr($instance['footer_widget_email']) : '';
|
||
|
$footer_social_icon_title = ($instance) ? esc_attr($instance['footer_social_icon_title']) : '';
|
||
|
$show_v2 = ($instance) ? esc_attr($instance['show_v2']) : '';
|
||
|
?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_widget_title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_widget_title')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_widget_title')); ?>" type="text" value="<?php echo esc_attr( $footer_widget_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_widget_email')); ?>"><?php esc_html_e('Email Address: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_widget_email')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_widget_email')); ?>" type="text" value="<?php echo esc_attr( $footer_widget_email ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_social_icon_title')); ?>"><?php esc_html_e('Social Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_social_icon_title')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_social_icon_title')); ?>" type="text" value="<?php echo esc_attr( $footer_social_icon_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('show_v2')); ?>"><?php esc_html_e('Show Social Icons:', 'thinkai'); ?></label>
|
||
|
<?php $selected = ( $show_v2 ) ? ' checked="checked"' : ''; ?>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('show_v2')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show_v2')); ?>" type="checkbox" value="true" />
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
///----footer V3 widgets---
|
||
|
//About Us
|
||
|
class Thinkai_About_Us extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_About_Us', /* Name */esc_html__('Thinkai About Us','thinkai'), array( 'description' => esc_html__('Show the About Us', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
echo wp_kses_post($before_widget);
|
||
|
?>
|
||
|
|
||
|
<div class="marbtm">
|
||
|
<div class="single-footer-widget--our-company-info sec-title-animation animation-style3">
|
||
|
<div class="download-app-box">
|
||
|
<?php if($instance[ 'footer_app_store_link' ] || $instance[ 'footer_android_link' ]){ ?>
|
||
|
<ul>
|
||
|
<?php if($instance[ 'footer_app_store_link' ]){ ?>
|
||
|
<li>
|
||
|
<a href="<?php echo esc_url( $instance[ 'footer_app_store_link' ] );?>">
|
||
|
<img src="<?php echo esc_url( $instance[ 'widget_app_store_image' ] );?>" alt="<?php bloginfo( 'name' ); ?>">
|
||
|
</a>
|
||
|
</li>
|
||
|
<?php } ?>
|
||
|
|
||
|
<?php if($instance[ 'footer_android_link' ]){ ?>
|
||
|
<li>
|
||
|
<a href="<?php echo esc_url( $instance[ 'footer_android_link' ] );?>">
|
||
|
<img src="<?php echo esc_url( $instance[ 'widget_android_image' ] );?>" alt="<?php bloginfo( 'name' ); ?>">
|
||
|
</a>
|
||
|
</li>
|
||
|
<?php } ?>
|
||
|
</ul>
|
||
|
<?php } ?>
|
||
|
|
||
|
<h3><?php echo wp_kses( $instance[ 'footer_description_v3' ], true );?></h3>
|
||
|
</div>
|
||
|
|
||
|
<div class="footer-logo-style2">
|
||
|
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $instance[ 'widget_logo_image' ] );?>" alt="<?php bloginfo( 'name' ); ?>"></a>
|
||
|
</div>
|
||
|
|
||
|
<?php if($instance[ 'footer_about_desc' ]){ ?>
|
||
|
<div class="text title-animation">
|
||
|
<p><?php echo wp_kses( $instance[ 'footer_about_desc' ], true );?> </p>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['widget_app_store_image'] = $new_instance['widget_app_store_image'];
|
||
|
$instance['footer_app_store_link'] = $new_instance['footer_app_store_link'];
|
||
|
$instance['widget_android_image'] = $new_instance['widget_android_image'];
|
||
|
$instance['footer_android_link'] = $new_instance['footer_android_link'];
|
||
|
$instance['footer_description_v3'] = $new_instance['footer_description_v3'];
|
||
|
$instance['widget_logo_image'] = $new_instance['widget_logo_image'];
|
||
|
$instance['footer_about_desc'] = $new_instance['footer_about_desc'];
|
||
|
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$widget_app_store_image = ($instance) ? esc_attr($instance['widget_app_store_image']) : '';
|
||
|
$footer_app_store_link = ($instance) ? esc_attr($instance['footer_app_store_link']) : '';
|
||
|
$widget_android_image = ($instance) ? esc_attr($instance['widget_android_image']) : '';
|
||
|
$footer_android_link = ($instance) ? esc_attr($instance['footer_android_link']) : '';
|
||
|
$footer_description_v3 = ($instance) ? esc_attr($instance['footer_description_v3']) : '';
|
||
|
$widget_logo_image = ($instance) ? esc_attr($instance['widget_logo_image']) : '';
|
||
|
$footer_about_desc = ($instance) ? esc_attr($instance['footer_about_desc']) : '';
|
||
|
|
||
|
?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('widget_app_store_image')); ?>"><?php esc_html_e('App Store Image: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_app_store_image')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_app_store_image')); ?>" type="text" value="<?php echo esc_attr( $widget_app_store_image ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_app_store_link')); ?>"><?php esc_html_e('App Store Link: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_app_store_link')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_app_store_link')); ?>" type="text" value="<?php echo esc_attr( $footer_app_store_link ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('widget_android_image')); ?>"><?php esc_html_e('Android Image: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_android_image')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_android_image')); ?>" type="text" value="<?php echo esc_attr( $widget_android_image ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_android_link')); ?>"><?php esc_html_e('Android Link: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_android_link')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_android_link')); ?>" type="text" value="<?php echo esc_attr( $footer_android_link ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_description_v3')); ?>"><?php esc_html_e('Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_description_v3')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_description_v3')); ?>" ><?php echo wp_kses_post($footer_description_v3); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('widget_logo_image')); ?>"><?php esc_html_e('Logo Image Url: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_logo_image')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_image')); ?>" type="text" value="<?php echo esc_attr( $widget_logo_image ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_about_desc')); ?>"><?php esc_html_e('About Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_about_desc')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_about_desc')); ?>" ><?php echo wp_kses_post($footer_about_desc); ?></textarea>
|
||
|
</p>
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//Newsletter
|
||
|
class Thinkai_Newsletter extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Newsletter', /* Name */esc_html__('Thinkai Newsletter','thinkai'), array( 'description' => esc_html__('Show the Newsletter Widget', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
echo wp_kses_post($before_widget);?>
|
||
|
|
||
|
<div class="martop">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<div class="newsletter-style1__content footer-widget-newsletter-box-style2">
|
||
|
<div class="text">
|
||
|
<p><?php echo wp_kses( $instance[ 'form_description' ], true );?></p>
|
||
|
</div>
|
||
|
<?php echo do_shortcode($instance['mailchimp_form_url']); ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['form_description'] = $new_instance['form_description'];
|
||
|
$instance['mailchimp_form_url'] = $new_instance['mailchimp_form_url'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ($instance) ? esc_attr($instance['title']) : '';
|
||
|
$form_description = ($instance) ? esc_attr($instance['form_description']) : '';
|
||
|
$mailchimp_form_url = ($instance) ? esc_attr($instance['mailchimp_form_url']) : '';
|
||
|
?>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('form_description')); ?>"><?php esc_html_e('Form Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('form_description')); ?>" name="<?php echo esc_attr($this->get_field_name('form_description')); ?>" ><?php echo wp_kses_post($form_description); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('mailchimp_form_url')); ?>"><?php esc_html_e('Mailchimp Form URL:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('mailchimp_form_url')); ?>" name="<?php echo esc_attr($this->get_field_name('mailchimp_form_url')); ?>" ><?php echo wp_kses_post($mailchimp_form_url); ?></textarea>
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
///----footer V5 widgets---
|
||
|
//About Us V2
|
||
|
class Thinkai_About_Us_V2 extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_About_Us_V2', /* Name */esc_html__('Thinkai About Us V2','thinkai'), array( 'description' => esc_html__('Show the About Us v2', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
echo wp_kses_post($before_widget);
|
||
|
?>
|
||
|
|
||
|
<div class="our-company-info-style5 sec-title-animation animation-style3">
|
||
|
<?php if($instance[ 'widget_logo_image_v2' ]){ ?>
|
||
|
<div class="footer-logo-style2">
|
||
|
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||
|
<img src="<?php echo esc_url( $instance[ 'widget_logo_image_v2' ] );?>" alt="<?php bloginfo( 'name' ); ?>">
|
||
|
</a>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
<div class="text title-animation">
|
||
|
<p><?php echo wp_kses( $instance[ 'footer_widget_description' ], true );?></p>
|
||
|
</div>
|
||
|
<?php if( $instance['show'] ){ ?>
|
||
|
<div class="footer-social-link-style5">
|
||
|
<ul class="clearfix">
|
||
|
<?php echo thinkai_get_social_icon_two();?>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['widget_logo_image_v2'] = $new_instance['widget_logo_image_v2'];
|
||
|
$instance['footer_widget_description'] = $new_instance['footer_widget_description'];
|
||
|
$instance['show'] = $new_instance['show'];
|
||
|
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$widget_logo_image_v2 = ($instance) ? esc_attr($instance['widget_logo_image_v2']) : '';
|
||
|
$footer_widget_description = ($instance) ? esc_attr($instance['footer_widget_description']) : '';
|
||
|
$show = ($instance) ? esc_attr($instance['show']) : '';
|
||
|
?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('widget_logo_image_v2')); ?>"><?php esc_html_e('Logo Image URL: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('widget_logo_image_v2')); ?>" name="<?php echo esc_attr($this->get_field_name('widget_logo_image_v2')); ?>" type="text" value="<?php echo esc_attr( $widget_logo_image_v2 ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_widget_description')); ?>"><?php esc_html_e('Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_widget_description')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_widget_description')); ?>" ><?php echo wp_kses_post($footer_widget_description); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('show')); ?>"><?php esc_html_e('Show Social Icons:', 'thinkai'); ?></label>
|
||
|
<?php $selected = ( $show ) ? ' checked="checked"' : ''; ?>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('show')); ?>"<?php echo esc_attr($selected); ?> name="<?php echo esc_attr($this->get_field_name('show')); ?>" type="checkbox" value="true" />
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//Copyright
|
||
|
class Thinkai_Copyright extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Copyright', /* Name */esc_html__('Thinkai Copyright','thinkai'), array( 'description' => esc_html__('Show the Copyright', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
echo wp_kses_post($before_widget);
|
||
|
?>
|
||
|
|
||
|
<!--Scroll to top-->
|
||
|
<div class="scroll-to-top">
|
||
|
<div class="scroll-top-inner">
|
||
|
<div class="icon-box">
|
||
|
<span class="icon-top-arrow"></span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- Scroll to top End -->
|
||
|
<div class="copyright-text-style3 text-right">
|
||
|
<ul>
|
||
|
<?php echo wp_kses( $instance[ 'footer_widget_privacy_menu' ], true );?>
|
||
|
</ul>
|
||
|
<p>
|
||
|
<?php echo wp_kses( $instance[ 'footer_widget_copyright' ], true );?>
|
||
|
</p>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['footer_widget_privacy_menu'] = $new_instance['footer_widget_privacy_menu'];
|
||
|
$instance['footer_widget_copyright'] = $new_instance['footer_widget_copyright'];
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$footer_widget_privacy_menu = ($instance) ? esc_attr($instance['footer_widget_privacy_menu']) : '';
|
||
|
$footer_widget_copyright = ($instance) ? esc_attr($instance['footer_widget_copyright']) : '';
|
||
|
?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_widget_privacy_menu')); ?>"><?php esc_html_e('Menu Raw Html:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_widget_privacy_menu')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_widget_privacy_menu')); ?>" ><?php echo wp_kses_post($footer_widget_privacy_menu); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('footer_widget_copyright')); ?>"><?php esc_html_e('Copyright:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('footer_widget_copyright')); ?>" name="<?php echo esc_attr($this->get_field_name('footer_widget_copyright')); ?>" ><?php echo wp_kses_post($footer_widget_copyright); ?></textarea>
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//Blog Widgets
|
||
|
//Popular Posts
|
||
|
class Thinkai_Popular_Posts extends WP_Widget
|
||
|
{
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Popular_Posts', /* Name */esc_html__('Thinkai Popular Posts','thinkai'), array( 'description' => esc_html__('Show the Popular Posts', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
|
||
|
echo wp_kses_post($before_widget); ?>
|
||
|
|
||
|
<!--Start Single Sidebar Box Style2-->
|
||
|
<div class="single-sidebar-box-style2 sidebar-popular-post">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<ul class="popular-post">
|
||
|
<?php $query_string = array('showposts'=>$instance['number']);
|
||
|
if ($instance['cat']) {
|
||
|
$query_string['tax_query'] = array(array('taxonomy' => 'category','field' => 'id','terms' => (array)$instance['cat']));
|
||
|
}
|
||
|
$this->posts($query_string); ?>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<!--End Single Sidebar Box Style2-->
|
||
|
|
||
|
<?php echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/* @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['number'] = $new_instance['number'];
|
||
|
$instance['cat'] = $new_instance['cat'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/* @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ( $instance ) ? esc_attr($instance['title']) : esc_html__('Popular Post', 'thinkai');
|
||
|
$number = ( $instance ) ? esc_attr($instance['number']) : 3;
|
||
|
$cat = ( $instance ) ? esc_attr($instance['cat']) : '';?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('No. of Posts:', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('categories')); ?>"><?php esc_html_e('Category', 'thinkai'); ?></label>
|
||
|
<?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'thinkai'), 'taxonomy' => 'category', 'selected'=>$cat, 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
function posts($query_string)
|
||
|
{
|
||
|
|
||
|
$query = new WP_Query($query_string);
|
||
|
if( $query->have_posts() ):?>
|
||
|
|
||
|
<!-- Title -->
|
||
|
<?php
|
||
|
while ( $query->have_posts() ) : $query->the_post();
|
||
|
?>
|
||
|
<li>
|
||
|
<div class="img-box">
|
||
|
<?php the_post_thumbnail('full'); ?>
|
||
|
<a href="<?php echo esc_url(get_the_permalink(get_the_id()));?>"><span class="fa fa-link"></span></a>
|
||
|
</div>
|
||
|
<div class="text-box">
|
||
|
<p><?php echo get_the_date('');?></p>
|
||
|
<h4>
|
||
|
<a href="<?php echo esc_url(get_the_permalink(get_the_id()));?>"><?php the_title(); ?> </a>
|
||
|
</h4>
|
||
|
</div>
|
||
|
</li>
|
||
|
|
||
|
<?php endwhile; ?>
|
||
|
|
||
|
<?php endif;
|
||
|
wp_reset_postdata();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//Banner Widget
|
||
|
class Thinkai_Banner extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Banner', /* Name */esc_html__('Thinkai Banner Widget','thinkai'), array( 'description' => esc_html__('Show the Banner Widget', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
echo wp_kses_post($before_widget);?>
|
||
|
|
||
|
<!--Start Sidebar Banner Box-->
|
||
|
<div class="sidebar-banner-box">
|
||
|
<div class="sidebar-banner-box__img-bg" style="background-image: url(<?php echo esc_url($instance['bg_img']); ?>);"></div>
|
||
|
<div class="sidebar-banner__content-box text-center">
|
||
|
<div class="thm-logo">
|
||
|
<span class="icon-thm-logo1"></span>
|
||
|
</div>
|
||
|
<h3><?php echo wp_kses( $instance[ 'banner_title' ], true );?></h3>
|
||
|
<p><?php echo wp_kses( $instance[ 'banner_text' ], true );?></p>
|
||
|
<div class="btn-box">
|
||
|
<a class="btn-one" href="<?php echo esc_url( $instance[ 'btn_link' ], true );?>">
|
||
|
<span class="txt">
|
||
|
<?php echo wp_kses( $instance[ 'btn_title' ], true );?>
|
||
|
</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!--End Sidebar Banner Box-->
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['bg_img'] = $new_instance['bg_img'];
|
||
|
$instance['banner_title'] = $new_instance['banner_title'];
|
||
|
$instance['banner_text'] = $new_instance['banner_text'];
|
||
|
$instance['btn_title'] = $new_instance['btn_title'];
|
||
|
$instance['btn_link'] = $new_instance['btn_link'];
|
||
|
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$bg_img = ($instance) ? esc_attr($instance['bg_img']) : '';
|
||
|
$banner_title = ($instance) ? esc_attr($instance['banner_title']) : '';
|
||
|
$banner_text = ($instance) ? esc_attr($instance['banner_text']) : '';
|
||
|
$btn_title = ($instance) ? esc_attr($instance['btn_title']) : '';
|
||
|
$btn_link = ($instance) ? esc_attr($instance['btn_link']) : '';
|
||
|
|
||
|
?>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('bg_img')); ?>"><?php esc_html_e('Background Image URL: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('bg_img')); ?>" name="<?php echo esc_attr($this->get_field_name('bg_img')); ?>" type="text" value="<?php echo esc_attr( $bg_img ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('banner_title')); ?>"><?php esc_html_e('Title:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('banner_title')); ?>" name="<?php echo esc_attr($this->get_field_name('banner_title')); ?>" ><?php echo wp_kses_post($banner_title); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('banner_text')); ?>"><?php esc_html_e('Description:', 'thinkai'); ?></label>
|
||
|
<textarea class="widefat" id="<?php echo esc_attr($this->get_field_id('banner_text')); ?>" name="<?php echo esc_attr($this->get_field_name('banner_text')); ?>" ><?php echo wp_kses_post($banner_text); ?></textarea>
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('btn_title')); ?>"><?php esc_html_e('Button Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_title')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_title')); ?>" type="text" value="<?php echo esc_attr( $btn_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('btn_link')); ?>"><?php esc_html_e('External Link: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_link')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_link')); ?>" type="text" value="<?php echo esc_attr( $btn_link ); ?>" />
|
||
|
</p>
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
///Shop Widgets
|
||
|
//Price Range Widget
|
||
|
class Thinkai_Price_Range extends WP_Widget
|
||
|
{
|
||
|
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Price_Range', /* Name */esc_html__('Thinkai Price Range Widget','thinkai'), array( 'description' => esc_html__('Show the Price Range Widget', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
|
||
|
echo wp_kses_post($before_widget);?>
|
||
|
|
||
|
<div class="filter-widget">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<div class="range-slider clearfix">
|
||
|
<div class="price-range-slider"></div>
|
||
|
<div class="filter-content">
|
||
|
<div class="price-box">
|
||
|
<?php if($instance['price_title']) { ?><h6><?php echo wp_kses( $instance[ 'price_title' ], true );?></h6><?php } ?>
|
||
|
<div class="title"></div>
|
||
|
<div class="input"><input type="text" class="property-amount" name="field-name" readonly></div>
|
||
|
</div>
|
||
|
<?php if($instance['btn_title']) { ?><button class="filter-btn"><?php echo wp_kses( $instance[ 'btn_title' ], true );?></button><?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['price_title'] = $new_instance['price_title'];
|
||
|
$instance['btn_title'] = $new_instance['btn_title'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ($instance) ? esc_attr($instance['title']) : '';
|
||
|
$price_title = ($instance) ? esc_attr($instance['price_title']) : '';
|
||
|
$btn_title = ($instance) ? esc_attr($instance['btn_title']) : '';
|
||
|
?>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('price_title')); ?>"><?php esc_html_e('Price Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('price_title')); ?>" name="<?php echo esc_attr($this->get_field_name('price_title')); ?>" type="text" value="<?php echo esc_attr( $price_title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('btn_title')); ?>"><?php esc_html_e('Button Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('btn_title')); ?>" name="<?php echo esc_attr($this->get_field_name('btn_title')); ?>" type="text" value="<?php echo esc_attr( $btn_title ); ?>" />
|
||
|
</p>
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//Popular Products
|
||
|
class Thinkai_Popular_Products extends WP_Widget
|
||
|
{
|
||
|
/** constructor */
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct( /* Base ID */'Thinkai_Popular_Products', /* Name */esc_html__('Thinkai Popular Products','thinkai'), array( 'description' => esc_html__('Show the Popular Products', 'thinkai' )) );
|
||
|
}
|
||
|
|
||
|
/** @see WP_Widget::widget */
|
||
|
function widget($args, $instance)
|
||
|
{
|
||
|
extract( $args );
|
||
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
||
|
|
||
|
echo wp_kses_post($before_widget); ?>
|
||
|
|
||
|
<div class="post-widget">
|
||
|
<?php echo wp_kses_post($before_title.$title.$after_title); ?>
|
||
|
<div class="post-inner">
|
||
|
<?php
|
||
|
$args = array('post_type' => 'product', 'showposts'=>$instance['number']);
|
||
|
if( $instance['cat'] ) $args['tax_query'] = array(array('taxonomy' => 'product_cat','field' => 'id','terms' => (array)$instance['cat']));
|
||
|
|
||
|
$this->posts($args);
|
||
|
?>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<?php echo wp_kses_post($after_widget);
|
||
|
}
|
||
|
|
||
|
|
||
|
/* @see WP_Widget::update */
|
||
|
function update($new_instance, $old_instance)
|
||
|
{
|
||
|
$instance = $old_instance;
|
||
|
$instance['title'] = strip_tags($new_instance['title']);
|
||
|
$instance['number'] = $new_instance['number'];
|
||
|
$instance['cat'] = $new_instance['cat'];
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/* @see WP_Widget::form */
|
||
|
function form($instance)
|
||
|
{
|
||
|
$title = ( $instance ) ? esc_attr($instance['title']) : esc_html__('Popular Products', 'thinkai');
|
||
|
$number = ( $instance ) ? esc_attr($instance['number']) : 3;
|
||
|
$cat = ( $instance ) ? esc_attr($instance['cat']) : '';?>
|
||
|
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title: ', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php esc_html_e('No. of Posts:', 'thinkai'); ?></label>
|
||
|
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" />
|
||
|
</p>
|
||
|
<p>
|
||
|
<label for="<?php echo esc_attr($this->get_field_id('categories')); ?>"><?php esc_html_e('Category', 'thinkai'); ?></label>
|
||
|
<?php wp_dropdown_categories(array('show_option_all'=>esc_html__('All Categories', 'thinkai'), 'taxonomy' => 'category', 'selected'=>$cat, 'class'=>'widefat', 'name'=>$this->get_field_name('cat'))); ?>
|
||
|
</p>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
function posts($query_string)
|
||
|
{
|
||
|
|
||
|
$query = new WP_Query($query_string);
|
||
|
if( $query->have_posts() ):?>
|
||
|
|
||
|
<!-- Title -->
|
||
|
<?php
|
||
|
global $post;
|
||
|
while ( $query->have_posts() ) : $query->the_post();
|
||
|
$post_thumbnail_id = get_post_thumbnail_id($post->ID);
|
||
|
$post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id);
|
||
|
?>
|
||
|
|
||
|
<div class="post">
|
||
|
<figure class="post-thumb"><a href="<?php echo esc_url( the_permalink( get_the_id() ) );?>"><?php the_post_thumbnail('thinkai_70x70'); ?></a></figure>
|
||
|
<h4><a href="<?php echo esc_url( the_permalink( get_the_id() ) );?>"><?php the_title();?></a></h4>
|
||
|
<h5><?php woocommerce_template_single_price(); ?></h5>
|
||
|
<p><?php echo (get_post_meta( get_the_id(), 'designation', true ));?></p>
|
||
|
</div>
|
||
|
|
||
|
<?php endwhile; ?>
|
||
|
|
||
|
<?php endif;
|
||
|
wp_reset_postdata();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|