Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/theme-to...
File: site-logo.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Theme Tools: Site Logo.
[2] Fix | Delete
*
[3] Fix | Delete
* @see https://jetpack.com/support/site-logo/
[4] Fix | Delete
*
[5] Fix | Delete
* This feature will only be activated for themes that declare their support.
[6] Fix | Delete
* This can be done by adding code similar to the following during the
[7] Fix | Delete
* 'after_setup_theme' action:
[8] Fix | Delete
*
[9] Fix | Delete
* $args = array(
[10] Fix | Delete
* 'header-text' => array(
[11] Fix | Delete
* 'site-title',
[12] Fix | Delete
* 'site-description',
[13] Fix | Delete
* ),
[14] Fix | Delete
* 'size' => 'medium',
[15] Fix | Delete
* );
[16] Fix | Delete
* add_theme_support( 'site-logo', $args );
[17] Fix | Delete
*
[18] Fix | Delete
* @package automattic/jetpack
[19] Fix | Delete
*/
[20] Fix | Delete
[21] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[22] Fix | Delete
exit( 0 );
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* Activate the Site Logo plugin.
[27] Fix | Delete
*
[28] Fix | Delete
* @uses current_theme_supports()
[29] Fix | Delete
* @since 3.2.0
[30] Fix | Delete
* @since 9.9.0 Uses Core site_logo option format universally.
[31] Fix | Delete
*/
[32] Fix | Delete
function site_logo_init() {
[33] Fix | Delete
// Only load our code if our theme declares support, and the standalone plugin is not activated.
[34] Fix | Delete
if ( current_theme_supports( 'site-logo' ) && ! class_exists( 'Site_Logo', false ) ) {
[35] Fix | Delete
_deprecated_hook( 'site-logo', '13.4', 'custom-logo', 'Jetpack no longer supports site-logo feature. Add custom-logo support to your theme instead: https://developer.wordpress.org/themes/functionality/custom-logo/' );
[36] Fix | Delete
// Load our class for namespacing.
[37] Fix | Delete
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
[38] Fix | Delete
// wpcom handles the image sizes differently.
[39] Fix | Delete
require_once WPMU_PLUGIN_DIR . '/site-logo/inc/class-site-logo.php';
[40] Fix | Delete
} else {
[41] Fix | Delete
require __DIR__ . '/site-logo/inc/class-site-logo.php';
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
// Load template tags.
[45] Fix | Delete
require __DIR__ . '/site-logo/inc/functions.php';
[46] Fix | Delete
[47] Fix | Delete
// Load backwards-compatible template tags.
[48] Fix | Delete
require __DIR__ . '/site-logo/inc/compat.php';
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
add_action( 'init', 'site_logo_init' );
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* When switching from a legacy theme that uses `site-logo` to a theme that uses `custom-logo`,
[55] Fix | Delete
* update the theme's custom logo if it doesn't already have one.
[56] Fix | Delete
*
[57] Fix | Delete
* @return void
[58] Fix | Delete
*/
[59] Fix | Delete
function jetpack_update_custom_logo_from_site_logo() {
[60] Fix | Delete
$site_logo = get_option( 'site_logo' );
[61] Fix | Delete
[62] Fix | Delete
if ( current_theme_supports( 'custom-logo' ) && ! get_theme_mod( 'custom_logo' ) && $site_logo ) {
[63] Fix | Delete
set_theme_mod( 'custom_logo', $site_logo );
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
add_action( 'after_switch_theme', 'jetpack_update_custom_logo_from_site_logo', 10, 0 );
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Transforms the legacy site_logo array, when present, into an attachment ID.
[70] Fix | Delete
*
[71] Fix | Delete
* The attachment ID is the format used for the site_logo option by the Site Logo block,
[72] Fix | Delete
* and the updated Jetpack site-logo feature.
[73] Fix | Delete
*
[74] Fix | Delete
* @since 9.9.0
[75] Fix | Delete
*
[76] Fix | Delete
* @param int|array|WP_Error $site_logo Option.
[77] Fix | Delete
* @return int|WP_Error
[78] Fix | Delete
*/
[79] Fix | Delete
function jetpack_site_logo_block_compat( $site_logo ) {
[80] Fix | Delete
if ( is_array( $site_logo ) && isset( $site_logo['id'] ) ) {
[81] Fix | Delete
remove_filter( 'option_site_logo', 'jetpack_site_logo_block_compat', 1 );
[82] Fix | Delete
update_option( 'site_logo', $site_logo['id'] );
[83] Fix | Delete
return $site_logo['id'];
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
return $site_logo;
[87] Fix | Delete
}
[88] Fix | Delete
add_filter( 'option_site_logo', 'jetpack_site_logo_block_compat', 1 );
[89] Fix | Delete
[90] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function