<?php
/**
* About Us Widget
*/
class Cyarb_logo_info extends WP_Widget{
function __construct(){
$widget_ops = array('description' => esc_html__('Display About Info', 'cyarb-toolkit'));
parent::__construct( false, esc_html__('Cyarb Footer About', 'cyarb-toolkit'), $widget_ops);
}
function widget($args, $instance){
extract($args);
global $cyarb_theme;
$title = apply_filters('widget_title', $instance['title']);
echo wp_kses_post($before_widget);
?>
<a class="logo d-inline-block" href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php if ( $instance['logo-img'] !='' ) : ?>
<img src="<?php echo esc_url($instance['logo-img'] ); ?> " alt="<?php esc_attr_e( 'Footer Logo', 'cyarb' ); ?>" >
<?php elseif( $instance['title'] != '' ): ?>
<h2 class="footer-title"><?php echo esc_html($instance['title']); ?></h2>
<?php endif; ?>
</a>
<?php if( $instance['logo_info'] != '' ): ?>
<p><?php echo esc_html($instance['logo_info']); ?></p>
<?php endif; ?>
<ul class="social-links">
<?php if( $instance['facebook_url'] != '' ): ?>
<li>
<a href="<?php echo esc_url($instance['facebook_url']); ?>" target="_blank"><i class='lni lni-facebook-filled'></i></a>
</li>
<?php endif; ?>
<?php if( $instance['twitter_url'] != '' ): ?>
<li>
<a href="<?php echo esc_url($instance['twitter_url']); ?>" target="_blank"><i class='lni lni-twitter-original'></i></a>
</li>
<?php endif; ?>
<?php if( $instance['instagram_url'] != '' ): ?>
<li>
<a href="<?php echo esc_url($instance['instagram_url']); ?>" target="_blank"><i class='lni lni-instagram-original'></i></a>
</li>
<?php endif; ?>
<?php if( $instance['youtube_url'] != '' ): ?>
<li>
<a href="<?php echo esc_url($instance['youtube_url']); ?>" target="_blank"><i class='lni lni-youtube'></i></a>
</li>
<?php endif; ?>
</ul>
<?php
echo wp_kses_post($after_widget);
}
function update($new_instance, $old_instance){
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['logo_info'] = $new_instance['logo_info'];
$instance['facebook_url'] = $new_instance['facebook_url'];
$instance['twitter_url'] = $new_instance['twitter_url'];
$instance['instagram_url'] = $new_instance['instagram_url'];
$instance['youtube_url'] = $new_instance['youtube_url'];
$instance['logo-img'] = $new_instance['logo-img'];
return $instance;
}
function form($instance){
$defaults = array(
'title' => esc_html__('Cyarb', 'cyarb-toolkit'),
'logo_info' => esc_html__('Lorem ipsum dolor sit amet, consectetur, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Minim veniam.'),
'facebook_url' => '#',
'twitter_url' => '#',
'instagram_url' => '#',
'youtube_url' => '#',
'logo-img' => '',
);
$instance = wp_parse_args((array)$instance, $defaults);
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id('logo-img')); ?>">
<?php esc_html_e('Footer Logo:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('logo-img')); ?>" name="<?php echo esc_attr($this->get_field_name('logo-img')); ?>" type="text" value="<?php echo wp_kses_post($instance['logo-img']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>">
<?php esc_html_e('Title:', 'cyarb-toolkit'); ?>
<input class="widget" 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 wp_kses_post($instance['title']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('logo_info')); ?>">
<?php esc_html_e('Logo Info:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('logo_info')); ?>" name="<?php echo esc_attr($this->get_field_name('logo_info')); ?>" type="text" value="<?php echo wp_kses_post($instance['logo_info']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('facebook_url')); ?>">
<?php esc_html_e('Facebook URL:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('facebook_url')); ?>" name="<?php echo esc_attr($this->get_field_name('facebook_url')); ?>" type="text" value="<?php echo wp_kses_post($instance['facebook_url']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('twitter_url')); ?>">
<?php esc_html_e('Twitter URL:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('twitter_url')); ?>" name="<?php echo esc_attr($this->get_field_name('twitter_url')); ?>" type="text" value="<?php echo wp_kses_post($instance['twitter_url']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('instagram_url')); ?>">
<?php esc_html_e('Instagram URL:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('instagram_url')); ?>" name="<?php echo esc_attr($this->get_field_name('instagram_url')); ?>" type="text" value="<?php echo wp_kses_post($instance['instagram_url']); ?>" />
</label>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('youtube_url')); ?>">
<?php esc_html_e('Youtube URL:', 'cyarb-toolkit'); ?>
<input class="widget" id="<?php echo esc_attr($this->get_field_id('youtube_url')); ?>" name="<?php echo esc_attr($this->get_field_name('youtube_url')); ?>" type="text" value="<?php echo wp_kses_post($instance['youtube_url']); ?>" />
</label>
</p>
<?php
}
}
function cyarb_register_logo_info() {
register_widget('Cyarb_logo_info');
}
add_action('widgets_init', 'cyarb_register_logo_info');