-
Notifications
You must be signed in to change notification settings - Fork 1
/
set-fav-icon.php
executable file
·43 lines (34 loc) · 1.31 KB
/
set-fav-icon.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
<?php
/*
Plugin Name: Easy Set Favicon
Plugin URI: https://github.com/eftakhairul/Set-Fav-Icon/blob/master/README.md
Description: Set the fav-icon in your blog or website just by putting a link.
Version: 1.0
Author: Eftakhairul Islam & Sirajus Salayhin
Author URI: https://github.com/eftakhairul/Set-Fav-Icon/blob/master/README.md
License: GPL2
*/
include_once('installation-plugin.php');
register_activation_hook (__FILE__,'es_favicon_install');
register_deactivation_hook (__FILE__,'es_favicon_uninstall');
add_action('admin_menu', 'es_set_favicon_create_menu');
add_action('wp_head', 'es_enqueue_favicon_head');
add_action('admin_head', 'es_enqueue_favicon_head');
function es_set_favicon_create_menu()
{
$main_option_page = __FILE__;
add_menu_page('Set Fav Icon', 'Set Fav Icon Url', 'administrator', 'ad-fav-icon', 'es_save_favicon_url',plugins_url('/set-fav-icon/images/icon_pref_settings.gif','set-fav-icon'));
}
function es_enqueue_favicon_head()
{
global $wpdb;
$favIconTable = $wpdb->prefix . "fav_icon_link";
$result = $wpdb->get_results("SELECT * FROM $favIconTable WHERE id = 1");
if (!empty($result)) {
echo '<link rel="shortcut icon" href="' . $result[0]->link . '" type="image/x-icon" /><!-- Favicon -->';
}
}
function es_save_favicon_url()
{
include("save-icon-url.php");
}