summaryrefslogtreecommitdiff
path: root/inc/customizer/override-defaults.php
blob: e23fa62007dc3d5005a38266f0ad1185c5ff8e3d (plain) (blame)
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
69
70
<?php
/**
 * Override default customizer panels, sections, settings or controls.
 *
 * @package     Astra
 * @author      Astra
 * @copyright   Copyright (c) 2020, Astra
 * @link        https://wpastra.com/
 * @since       Astra 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Override Sections
 */
$wp_customize->get_section( 'title_tagline' )->priority = 5;
$wp_customize->get_section( 'title_tagline' )->panel    = 'panel-header-group';

/**
 * Override Settings
 */
$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_setting( 'custom_logo' )->transport      = 'refresh';

/**
 * Override Controls
 */
$wp_customize->get_control( 'custom_logo' )->priority      = 5;
$wp_customize->get_control( 'blogname' )->priority         = 8;
$wp_customize->get_control( 'blogdescription' )->priority  = 12;
$wp_customize->get_control( 'header_textcolor' )->priority = 9;
$wp_customize->get_control( 'site_icon' )->priority        = 16;
$wp_customize->get_control( 'site_icon' )->label           = '';

if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'blogname',
		array(
			'selector'            => '.main-header-bar .site-title a,  .ast-small-footer-wrap .ast-footer-site-title',
			'container_inclusive' => false,
			'render_callback'     => 'Astra_Customizer_Partials::render_partial_site_title',
		)
	);
}

if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'blogdescription',
		array(
			'selector'            => '.main-header-bar .site-description',
			'container_inclusive' => false,
			'render_callback'     => 'Astra_Customizer_Partials::render_partial_site_tagline',
		)
	);
}

/*
 * Modify WooCommerce default section priorities
*/
if ( class_exists( 'WooCommerce' ) ) {
	$wp_customize->get_section( 'woocommerce_store_notice' )->priority    = 9;
	$wp_customize->get_section( 'woocommerce_product_catalog' )->priority = 11;
	$wp_customize->get_section( 'woocommerce_checkout' )->priority        = 21;
	$wp_customize->get_panel( 'woocommerce' )->priority                   = 70;
}