summaryrefslogtreecommitdiff
blob: d6510c2b60ba8ad737ebfefa010df74f831a0d47 (plain)
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
<?php
/*
 * Site Logo.
 * @see http://jetpack.com/support/site-logo/
 *
 * This feature will only be activated for themes that declare their support.
 * This can be done by adding code similar to the following during the
 * 'after_setup_theme' action:
 *
 * $args = array(
 * 	'header-text' => array(
 * 		'site-title',
 * 		'site-description',
 * 	),
 * 	'size' => 'medium',
 * );
 * add_theme_support( 'site-logo', $args );
 *
 */

/**
 * Activate the Site Logo plugin.
 *
 * @uses current_theme_supports()
 * @since 3.2
 */
function site_logo_init() {
	// For transferring existing site logo from Jetpack -> Core
	if ( current_theme_supports( 'custom-logo' ) && ! get_theme_mod( 'custom_logo' ) && $jp_logo = get_option( 'site_logo' ) ) {
		set_theme_mod( 'custom_logo', $jp_logo['id'] );
		delete_option( 'site_logo' );
	}

	// Only load our code if our theme declares support, and the standalone plugin is not activated.
	if ( current_theme_supports( 'site-logo' ) && ! class_exists( 'Site_Logo', false ) ) {
		// Load our class for namespacing.
		require( dirname( __FILE__ ) . '/site-logo/inc/class-site-logo.php' );

		// Load template tags.
		require( dirname( __FILE__ ) . '/site-logo/inc/functions.php' );

		// Load backwards-compatible template tags.
		require( dirname( __FILE__ ) . '/site-logo/inc/compat.php' );
	}
}
add_action( 'init', 'site_logo_init' );