forked from pkoltermann/social-icons-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Social_Media_Widget_Improved.php
71 lines (56 loc) · 2.04 KB
/
Social_Media_Widget_Improved.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
Plugin Name: Social Media Widget Improved
Plugin URI: https://github.com/cumanzorx07/Social-Media-Widget-Improved
Version: 1.0
Description: This plugins provides a list of social media icon to link your profile with your site.
Author: Carlos Umanzor
Author URI: http://carlosumanzor.com/
Original Idea: Dan Nisbet (https://nisbetcreative.com/)
*/
class Social_Media_Widget_Improved extends WP_Widget {
function __construct() {
parent::__construct(
'social_media_widget_improved', // Base ID
'Social Media', // Widget Name
array(
'classname' => 'Social_Media_Widget_Improved',
'description' => 'Displays a list of social media website icons and a link to your profile with your site.',
),
array(
'width' => 600,
)
);
// Register Stylesheets
add_action('admin_print_styles', array($this, 'register_admin_styles'));
add_action('wp_enqueue_scripts', array($this, 'register_widget_styles'));
include('lib/social-networks.php');
}
function form($instance) {
include('lib/form.php');
}
function update($new_instance, $old_instance) {
global $smwi_social_accounts;
$instance = array();
foreach ($smwi_social_accounts as $site => $id) {
$instance[$id] = $new_instance[$id];
}
$instance['title'] = $new_instance['title'];
$instance['icons'] = $new_instance['icons'];
$instance['labels'] = $new_instance['labels'];
$instance['show_title'] = $new_instance['show_title'];
$instance['add_rel_publisher_to_google_plus'] = $new_instance['add_rel_publisher_to_google_plus'];
return $instance;
}
function widget($args, $instance) {
include('lib/widget.php');
}
function register_admin_styles() {
wp_enqueue_style('social_media_widget_improved-admin', plugins_url('Social-Media-Widget-Improved/css/social_media_admin.css'));
}
function register_widget_styles() {
wp_enqueue_style('social_media_widget_improved-widget', plugins_url('Social-Media-Widget-Improved/css/social_media_widget.css'));
}
}
add_action('widgets_init', create_function('', 'register_widget("Social_Media_Widget_Improved");') );
?>