|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Site Logo. |
|
4
|
|
|
* @see https://jetpack.com/support/site-logo/ |
|
5
|
|
|
* |
|
6
|
|
|
* This feature will only be activated for themes that declare their support. |
|
7
|
|
|
* This can be done by adding code similar to the following during the |
|
8
|
|
|
* 'after_setup_theme' action: |
|
9
|
|
|
* |
|
10
|
|
|
* $args = array( |
|
11
|
|
|
* 'header-text' => array( |
|
12
|
|
|
* 'site-title', |
|
13
|
|
|
* 'site-description', |
|
14
|
|
|
* ), |
|
15
|
|
|
* 'size' => 'medium', |
|
16
|
|
|
* ); |
|
17
|
|
|
* add_theme_support( 'site-logo', $args ); |
|
18
|
|
|
* |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Activate the Site Logo plugin. |
|
23
|
|
|
* |
|
24
|
|
|
* @uses current_theme_supports() |
|
25
|
|
|
* @since 3.2.0 |
|
26
|
|
|
* @since 9.9.0 Uses Core site_logo option format universally. |
|
27
|
|
|
*/ |
|
28
|
|
|
function site_logo_init() { |
|
29
|
|
|
// For transferring existing site logo from Jetpack -> Core. |
|
30
|
|
|
if ( current_theme_supports( 'custom-logo' ) && ! get_theme_mod( 'custom_logo' ) && get_option( 'site_logo' ) ) { |
|
31
|
|
|
$jp_logo = get_option( 'site_logo' ); |
|
32
|
|
|
// Is the Site Logo in the old Jetpack format? |
|
33
|
|
|
if ( ! empty( $jp_logo['id'] ) ) { |
|
34
|
|
|
set_theme_mod( 'custom_logo', $jp_logo['id'] ); |
|
35
|
|
|
update_option( 'site_logo', $jp_logo['id'] ); |
|
36
|
|
|
} |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
// Only load our code if our theme declares support, and the standalone plugin is not activated. |
|
40
|
|
|
if ( current_theme_supports( 'site-logo' ) && ! class_exists( 'Site_Logo', false ) ) { |
|
41
|
|
|
// Load our class for namespacing. |
|
42
|
|
|
require dirname( __FILE__ ) . '/site-logo/inc/class-site-logo.php'; |
|
43
|
|
|
|
|
44
|
|
|
// Load template tags. |
|
45
|
|
|
require dirname( __FILE__ ) . '/site-logo/inc/functions.php'; |
|
46
|
|
|
|
|
47
|
|
|
// Load backwards-compatible template tags. |
|
48
|
|
|
require dirname( __FILE__ ) . '/site-logo/inc/compat.php'; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
add_action( 'init', 'site_logo_init' ); |
|
52
|
|
|
|