• 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 / twentyfourteen_customize_register() – Implement Customizer additions and adjustments.

You appear to be a bot. Output may be restricted

Description

Implement Customizer additions and adjustments.

Usage

twentyfourteen_customize_register( $wp_customize );

Parameters

$wp_customize
( WP_Customize_Manager ) required – Customizer object.

Returns

void

Source

File name: twentyfourteen/inc/customizer.php
Lines:

1 to 78 of 78
function twentyfourteen_customize_register( $wp_customize ) {
  // Add postMessage support for site title and description.
  $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
  $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
  $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';

  if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial(
      'blogname',
      array(
        'selector'            => '.site-title a',
        'container_inclusive' => false,
        'render_callback'     => 'twentyfourteen_customize_partial_blogname',
      )
    );
    $wp_customize->selective_refresh->add_partial(
      'blogdescription',
      array(
        'selector'            => '.site-description',
        'container_inclusive' => false,
        'render_callback'     => 'twentyfourteen_customize_partial_blogdescription',
      )
    );
  }

  // Rename the label to "Site Title Color" because this only affects the site title in this theme.
  $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' );

  // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
  $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' );

  // Add custom description to Colors and Background controls or sections.
  if ( property_exists( $wp_customize->get_control( 'background_color' ), 'description' ) ) {
    $wp_customize->get_control( 'background_color' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' );
    $wp_customize->get_control( 'background_image' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' );
  } else {
    $wp_customize->get_section( 'colors' )->description           = __( 'Background may only be visible on wide screens.', 'twentyfourteen' );
    $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' );
  }

  // Add the featured content section in case it's not already there.
  $wp_customize->add_section(
    'featured_content',
    array(
      'title'           => __( 'Featured Content', 'twentyfourteen' ),
      'description'     => sprintf(
        /* translators: 1: Featured tag editor URL, 2: Post editor URL. */
        __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
        esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
        admin_url( 'edit.php?show_sticky=1' )
      ),
      'priority'        => 130,
      'active_callback' => 'is_front_page',
    )
  );

  // Add the featured content layout setting and control.
  $wp_customize->add_setting(
    'featured_content_layout',
    array(
      'default'           => 'grid',
      'sanitize_callback' => 'twentyfourteen_sanitize_layout',
    )
  );

  $wp_customize->add_control(
    'featured_content_layout',
    array(
      'label'   => __( 'Layout', 'twentyfourteen' ),
      'section' => 'featured_content',
      'type'    => 'select',
      'choices' => array(
        'grid'   => __( 'Grid', 'twentyfourteen' ),
        'slider' => __( 'Slider', 'twentyfourteen' ),
      ),
    )
  );
}
 

 View on Trac

Published: 19th December 2019 | Last updated: 8th April 2020

Primary Sidebar

Information

Function name: twentyfourteen_customize_register
Plugin ref: Twenty Fourteen
Version: 3.0
Sourcefile: inc/customizer.php
File ref: inc/customizer.php
API type: additions
Deprecated?: No
API Letters: C,R,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6. PHP: 7.3.26
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