esc_html__('Right Sidebar', 'toocheke'),
'id' => 'right-sidebar',
'description' => esc_html__('Add widgets here.', 'toocheke'),
'before_widget' => '',
'before_title' => '
',
));
}
add_action('widgets_init', 'toocheke_widgets_init');
/*
* About Widget
*/
if (!function_exists('toocheke_load_about_widget')):
function toocheke_load_about_widget()
{
register_widget('toocheke_about_widget');
}
endif;
add_action('widgets_init', 'toocheke_load_about_widget');
if (!class_exists('toocheke_about_widget')):
class toocheke_about_widget extends WP_Widget
{
public function __construct()
{
$widget_details = array(
'classname' => 'toocheke_about_widget',
'description' => esc_html__('Creates an about section consisting of a title, image/avatar, and a description. Ideal for the right sidebar on the Toocheke WP theme.', 'toocheke'),
);
parent::__construct('toocheke_about_widget', 'Toocheke: About Us', $widget_details);
add_action('admin_enqueue_scripts', array($this, 'toocheke_about_us_widget_assets'));
}
public function toocheke_about_us_widget_assets()
{
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script('toocheke-bootstrap', get_template_directory_uri() . '/dist/js/toocheke-media-upload.js', array('jquery'), '20190508', true);
wp_enqueue_style('thickbox');
}
public function widget($args, $instance)
{
$allowed_tags = array(
'section' => array(
'id' => array(),
'class' => array(),
),
'h4' => array(
'class' => array(),
),
);
echo wp_kses($args['before_widget'], $allowed_tags);
if (!empty($instance['title'])) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
echo wp_kses($args['before_title'], $allowed_tags) . wp_kses($title, $allowed_tags) . wp_kses($args['after_title'], $allowed_tags);
}
?>
' class='about-avatar' >
'toocheke_social_media social-links',
'description' => esc_html__('Add links to your social media profiles. Ideally for the right sidebar on the Toocheke WP theme. ', 'toocheke'),
);
parent::__construct('toocheke_social_media', 'Toocheke: Social', $widget_details);
}
public function widget($args, $instance)
{
$allowed_tags = array(
'section' => array(
'id' => array(),
'class' => array(),
),
'h4' => array(
'class' => array(),
),
);
echo wp_kses($args['before_widget'], $allowed_tags);
if (!empty($instance['title'])) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
echo wp_kses($args['before_title'], $allowed_tags) . wp_kses($title, $allowed_tags) . wp_kses($args['after_title'], $allowed_tags);
}
?>
" id="get_field_id('rss_url')); ?>" name="get_field_name('rss_url')); ?>" type="text" value="" />