• 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_theme_support() – Sets up theme defaults and registers support for various WordPress features.

You appear to be a bot. Output may be restricted

Description

Sets up theme defaults and registers support for various WordPress features.

Note that this function is hooked into the after_setup_theme hook, which runs before the init hook. The init hook is too late for some features, such as indicating support for post thumbnails.

Usage

twentytwenty_theme_support();

Parameters

Returns

void

Source

File name: twentytwenty/functions.php
Lines:

1 to 100 of 113
function twentytwenty_theme_support() {

  // Add default posts and comments RSS feed links to head.
  add_theme_support( 'automatic-feed-links' );

  // Custom background color.
  add_theme_support(
    'custom-background',
    array(
      'default-color' => 'f5efe0',
    )
  );

  // Set content-width.
  global $content_width;
  if ( ! isset( $content_width ) ) {
    $content_width = 580;
  }

  /*
	 * Enable support for Post Thumbnails on posts and pages.
	 *
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	 */
  add_theme_support( 'post-thumbnails' );

  // Set post thumbnail size.
  set_post_thumbnail_size( 1200, 9999 );

  // Add custom image size used in Cover Template.
  add_image_size( 'twentytwenty-fullscreen', 1980, 9999 );

  // Custom logo.
  $logo_width  = 120;
  $logo_height = 90;

  // If the retina setting is active, double the recommended width and height.
  if ( get_theme_mod( 'retina_logo', false ) ) {
    $logo_width  = floor( $logo_width * 2 );
    $logo_height = floor( $logo_height * 2 );
  }

  add_theme_support(
    'custom-logo',
    array(
      'height'      => $logo_height,
      'width'       => $logo_width,
      'flex-height' => true,
      'flex-width'  => true,
    )
  );

  /*
	 * Let WordPress manage the document title.
	 * By adding theme support, we declare that this theme does not use a
	 * hard-coded <title> tag in the document head, and expect WordPress to
	 * provide it for us.
	 */
  add_theme_support( 'title-tag' );

  /*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
  add_theme_support(
    'html5',
    array(
      'search-form',
      'comment-form',
      'comment-list',
      'gallery',
      'caption',
      'script',
      'style',
      'navigation-widgets',
    )
  );

  /*
	 * Make theme available for translation.
	 * Translations can be filed in the /languages/ directory.
	 * If you're building a theme based on Twenty Twenty, use a find and replace
	 * to change 'twentytwenty' to the name of your theme in all the template files.
	 */
  load_theme_textdomain( 'twentytwenty' );

  // Add support for full and wide align images.
  add_theme_support( 'align-wide' );

  // Add support for responsive embeds.
  add_theme_support( 'responsive-embeds' );

  /*
	 * Adds starter content to highlight the theme on fresh sites.
	 * This is done conditionally to avoid loading the starter content on every
	 * page load, as it is a one-off operation only needed once in the customizer.
	 */
  if ( is_customize_preview() ) {
    require get_template_directory() . '/inc/starter-content.php';
    add_theme_support( 'starter-content', twentytwenty_get_starter_content() );
 
[1] [2] Next »

 View on GitHub View on Trac

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

Primary Sidebar

Information

Function name: twentytwenty_theme_support
Plugin ref: Twenty Twenty
Version: 2.1
Sourcefile: functions.php
File ref: functions.php
Deprecated?: No
API Letters: S,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
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-2023. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites