Lines:
1 to 98 of 98
<?php /** * Twenty Sixteen functions and definitions * * Set up the theme and provides some helper functions, which are used in the * theme as custom template tags. Others are attached to action and filter * hooks in WordPress to change core functionality. * * When using a child theme you can override certain functions (those wrapped * in a function_exists() call) by defining them first in your child theme's * functions.php file. The child theme's functions.php file is included before * the parent theme's file, so the child theme functions would be used. * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/ * * Functions that are not pluggable (not wrapped in function_exists()) are * instead attached to a filter or action hook. * * For more information on hooks, actions, and filters, * {@link https://developer.wordpress.org/plugins/} * * @package WordPress * @subpackage Twenty_Sixteen * @since Twenty Sixteen 1.0 */ /** * Twenty Sixteen only works in WordPress 4.4 or later. */ if ( version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' ) ) { require get_template_directory() . '/inc/back-compat.php'; } if ( ! function_exists( 'twentysixteen_setup' ) ) : /* function twentysixteen_setup() – Sets up theme defaults and registers support for various WordPress features. */ endif; // twentysixteen_setup() add_action( 'after_setup_theme', 'twentysixteen_setup' ); /* function twentysixteen_content_width() – Sets the content width in pixels, based on the theme’s design and stylesheet. */ add_action( 'after_setup_theme', 'twentysixteen_content_width', 0 ); /* function twentysixteen_resource_hints() – Add preconnect for Google Fonts. */ add_filter( 'wp_resource_hints', 'twentysixteen_resource_hints', 10, 2 ); /* function twentysixteen_widgets_init() – Registers a widget area. */ add_action( 'widgets_init', 'twentysixteen_widgets_init' ); if ( ! function_exists( 'twentysixteen_fonts_url' ) ) : /* function twentysixteen_fonts_url() – Register Google fonts for Twenty Sixteen. */ endif; /* function twentysixteen_javascript_detection() – Handles JavaScript detection. */ add_action( 'wp_head', 'twentysixteen_javascript_detection', 0 ); /* function twentysixteen_scripts() – Enqueues scripts and styles. */ add_action( 'wp_enqueue_scripts', 'twentysixteen_scripts' ); /* function twentysixteen_block_editor_styles() – Enqueue styles for the block-based editor. */ add_action( 'enqueue_block_editor_assets', 'twentysixteen_block_editor_styles' ); /* function twentysixteen_body_classes() – Adds custom classes to the array of body classes. */ add_filter( 'body_class', 'twentysixteen_body_classes' ); /* function twentysixteen_hex2rgb() – Converts a HEX value to RGB. */ /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Block Patterns. */ require get_template_directory() . '/inc/block-patterns.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /* function twentysixteen_content_image_sizes_attr() – Add custom image sizes attribute to enhance responsive image functionality for content images */ add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr', 10, 2 ); /* function twentysixteen_post_thumbnail_sizes_attr() – Add custom image sizes attribute to enhance responsive image functionality for post thumbnails */ add_filter( 'wp_get_attachment_image_attributes', 'twentysixteen_post_thumbnail_sizes_attr', 10, 3 ); /* function twentysixteen_widget_tag_cloud_args() – Modifies tag cloud widget arguments to display all tags in the same font size and use list format for better accessibility. */ add_filter( 'widget_tag_cloud_args', 'twentysixteen_widget_tag_cloud_args' );