-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsocial-icons-widget.php
68 lines (53 loc) · 1.71 KB
/
social-icons-widget.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
<?php
/*
Plugin Name: Social Icons Widget
Plugin URI: http://github.com/dannisbet/Social-Icons-Widget
Version: 14.03
Description: Displays a list of social media website icons and a link to your profile.
Author: Dan Nisbet
Author URI: http://dannisbet.com/
*/
class Social_Icons_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'social-icons-widget', // Base ID
'Social Icons', // Widget Name
array(
'classname' => 'social-icons-widget',
'description' => 'Displays a list of social media website icons and a link to your profile.',
),
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 $social_accounts;
$instance = array();
foreach ($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'];
return $instance;
}
function widget($args, $instance) {
include('lib/widget.php');
}
function register_admin_styles() {
wp_enqueue_style('social-icons-widget-admin', plugins_url('social-media-icons-widget/css/social_icons_admin.css'));
}
function register_widget_styles() {
wp_enqueue_style('social-icons-widget-widget', plugins_url('social-media-icons-widget/css/social_icons_widget.css'));
}
}
add_action('widgets_init', create_function('', 'register_widget("Social_Icons_Widget");') );
?>