• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / TwentyTwenty_Customize::register() – Register customizer options.

You appear to be a bot. Output may be restricted

Description

Register customizer options.

Usage

TwentyTwenty_Customize::register( $wp_customize );

Parameters

$wp_customize
( WP_Customize_Manager ) required – Theme Customizer object.

Returns

void

Source

File name: twentytwenty/classes/class-twentytwenty-customize.php


Lines:

101 to 200 of 396
      $wp_customize->add_setting(
        'accent_hue',
        array(
          'default'           => 344,
          'type'              => 'theme_mod',
          'sanitize_callback' => 'absint',
          'transport'         => 'postMessage',
        )
      );

      // Add setting to hold colors derived from the accent hue.
      $wp_customize->add_setting(
        'accent_accessible_colors',
        array(
          'default'           => array(
            'content'       => array(
              'text'      => '#000000',
              'accent'    => '#cd2653',
              'secondary' => '#6d6d6d',
              'borders'   => '#dcd7ca',
            ),
            'header-footer' => array(
              'text'      => '#000000',
              'accent'    => '#cd2653',
              'secondary' => '#6d6d6d',
              'borders'   => '#dcd7ca',
            ),
          ),
          'type'              => 'theme_mod',
          'transport'         => 'postMessage',
          'sanitize_callback' => array( __CLASS__, 'sanitize_accent_accessible_colors' ),
        )
      );

      // Add the hue-only colorpicker for the accent color.
      $wp_customize->add_control(
        new WP_Customize_Color_Control(
          $wp_customize,
          'accent_hue',
          array(
            'section'         => 'colors',
            'settings'        => 'accent_hue',
            'description'     => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ),
            'mode'            => 'hue',
            'active_callback' => function() use ( $wp_customize ) {
              return ( 'custom' === $wp_customize->get_setting( 'accent_hue_active' )->value() );
            },
          )
        )
      );

      // Update background color with postMessage, so inline CSS output is updated as well.
      $wp_customize->get_setting( 'background_color' )->transport = 'postMessage';

      
/**
 * Theme Options
 */

      $wp_customize->add_section(
        'options',
        array(
          'title'      => __( 'Theme Options', 'twentytwenty' ),
          'priority'   => 40,
          'capability' => 'edit_theme_options',
        )
      );

      /* Enable Header Search ----------------------------------------------- */

      $wp_customize->add_setting(
        'enable_header_search',
        array(
          'capability'        => 'edit_theme_options',
          'default'           => true,
          'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ),
        )
« Previous [1] [2] [3] [4] Next »

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: TwentyTwenty_Customize::register
Class ref: TwentyTwenty_Customize
Plugin ref: Twenty Twenty
Version: 1.6
Sourcefile: classes/class-twentytwenty-customize.php
File ref: classes/class-twentytwenty-customize.php
Deprecated?: No
API Letters: C,R,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6.2. PHP: 7.3.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites