예제 #1
0
/**
 * Register customizer panels, sections, controls, and/or settings.
 *
 * @since  3.0.0
 * @access public
 * @return void
 */
function hybrid_customize_register($wp_customize)
{
    // Always add the layout section so that theme devs can utilize it.
    $wp_customize->add_section('layout', array('title' => esc_html__('Layout', 'hybrid-core'), 'priority' => 30));
    // Check if the theme supports the theme layouts customize feature.
    if (current_theme_supports('theme-layouts', 'customize')) {
        // Add the layout setting.
        $wp_customize->add_setting('theme_layout', array('default' => hybrid_get_default_layout(), 'sanitize_callback' => 'sanitize_key', 'transport' => 'postMessage'));
        // Add the layout control.
        $wp_customize->add_control(new Hybrid_Customize_Control_Layout($wp_customize, 'theme_layout', array('label' => esc_html__('Global Layout', 'hybrid-core'))));
    }
}
예제 #2
0
/**
 * Returns the theme mod used for the global layout setting.
 *
 * @since  3.0.0
 * @access public
 * @return string
 */
function hybrid_get_global_layout()
{
    return get_theme_mod('theme_layout', hybrid_get_default_layout());
}