wp/wp-content/themes/twentyfourteen/functions.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    42 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
    42 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
    43 	require get_template_directory() . '/inc/back-compat.php';
    43 	require get_template_directory() . '/inc/back-compat.php';
    44 }
    44 }
    45 
    45 
    46 if ( ! function_exists( 'twentyfourteen_setup' ) ) :
    46 if ( ! function_exists( 'twentyfourteen_setup' ) ) :
    47 /**
    47 	/**
    48  * Twenty Fourteen setup.
    48 	 * Twenty Fourteen setup.
    49  *
       
    50  * Set up theme defaults and registers support for various WordPress features.
       
    51  *
       
    52  * Note that this function is hooked into the after_setup_theme hook, which
       
    53  * runs before the init hook. The init hook is too late for some features, such
       
    54  * as indicating support post thumbnails.
       
    55  *
       
    56  * @since Twenty Fourteen 1.0
       
    57  */
       
    58 function twentyfourteen_setup() {
       
    59 
       
    60 	/*
       
    61 	 * Make Twenty Fourteen available for translation.
       
    62 	 *
    49 	 *
    63 	 * Translations can be added to the /languages/ directory.
    50 	 * Set up theme defaults and registers support for various WordPress features.
    64 	 * If you're building a theme based on Twenty Fourteen, use a find and
    51 	 *
    65 	 * replace to change 'twentyfourteen' to the name of your theme in all
    52 	 * Note that this function is hooked into the after_setup_theme hook, which
    66 	 * template files.
    53 	 * runs before the init hook. The init hook is too late for some features, such
       
    54 	 * as indicating support post thumbnails.
       
    55 	 *
       
    56 	 * @since Twenty Fourteen 1.0
    67 	 */
    57 	 */
    68 	load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' );
    58 	function twentyfourteen_setup() {
    69 
    59 
    70 	// This theme styles the visual editor to resemble the theme style.
    60 		/*
    71 	add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) );
    61 		 * Make Twenty Fourteen available for translation.
    72 
    62 		 *
    73 	// Add RSS feed links to <head> for posts and comments.
    63 		 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfourteen
    74 	add_theme_support( 'automatic-feed-links' );
    64 		 * If you're building a theme based on Twenty Fourteen, use a find and
    75 
    65 		 * replace to change 'twentyfourteen' to the name of your theme in all
    76 	// Enable support for Post Thumbnails, and declare two sizes.
    66 		 * template files.
    77 	add_theme_support( 'post-thumbnails' );
    67 		 */
    78 	set_post_thumbnail_size( 672, 372, true );
    68 		load_theme_textdomain( 'twentyfourteen' );
    79 	add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
    69 
    80 
    70 		// This theme styles the visual editor to resemble the theme style.
    81 	// This theme uses wp_nav_menu() in two locations.
    71 		add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) );
    82 	register_nav_menus( array(
    72 
    83 		'primary'   => __( 'Top primary menu', 'twentyfourteen' ),
    73 		// Add RSS feed links to <head> for posts and comments.
    84 		'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
    74 		add_theme_support( 'automatic-feed-links' );
    85 	) );
    75 
    86 
    76 		// Enable support for Post Thumbnails, and declare two sizes.
    87 	/*
    77 		add_theme_support( 'post-thumbnails' );
    88 	 * Switch default core markup for search form, comment form, and comments
    78 		set_post_thumbnail_size( 672, 372, true );
    89 	 * to output valid HTML5.
    79 		add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
    90 	 */
    80 
    91 	add_theme_support( 'html5', array(
    81 		// This theme uses wp_nav_menu() in two locations.
    92 		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
    82 		register_nav_menus(
    93 	) );
    83 			array(
    94 
    84 				'primary'   => __( 'Top primary menu', 'twentyfourteen' ),
    95 	/*
    85 				'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
    96 	 * Enable support for Post Formats.
    86 			)
    97 	 * See https://codex.wordpress.org/Post_Formats
    87 		);
    98 	 */
    88 
    99 	add_theme_support( 'post-formats', array(
    89 		/*
   100 		'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery',
    90 		 * Switch default core markup for search form, comment form, and comments
   101 	) );
    91 		 * to output valid HTML5.
   102 
    92 		 */
   103 	// This theme allows users to set a custom background.
    93 		add_theme_support(
   104 	add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array(
    94 			'html5', array(
   105 		'default-color' => 'f5f5f5',
    95 				'search-form',
   106 	) ) );
    96 				'comment-form',
   107 
    97 				'comment-list',
   108 	// Add support for featured content.
    98 				'gallery',
   109 	add_theme_support( 'featured-content', array(
    99 				'caption',
   110 		'featured_content_filter' => 'twentyfourteen_get_featured_posts',
   100 			)
   111 		'max_posts' => 6,
   101 		);
   112 	) );
   102 
   113 
   103 		/*
   114 	// This theme uses its own gallery styles.
   104 		 * Enable support for Post Formats.
   115 	add_filter( 'use_default_gallery_style', '__return_false' );
   105 		 * See https://codex.wordpress.org/Post_Formats
   116 }
   106 		 */
       
   107 		add_theme_support(
       
   108 			'post-formats', array(
       
   109 				'aside',
       
   110 				'image',
       
   111 				'video',
       
   112 				'audio',
       
   113 				'quote',
       
   114 				'link',
       
   115 				'gallery',
       
   116 			)
       
   117 		);
       
   118 
       
   119 		// This theme allows users to set a custom background.
       
   120 		add_theme_support(
       
   121 			'custom-background', apply_filters(
       
   122 				'twentyfourteen_custom_background_args', array(
       
   123 					'default-color' => 'f5f5f5',
       
   124 				)
       
   125 			)
       
   126 		);
       
   127 
       
   128 		// Add support for featured content.
       
   129 		add_theme_support(
       
   130 			'featured-content', array(
       
   131 				'featured_content_filter' => 'twentyfourteen_get_featured_posts',
       
   132 				'max_posts'               => 6,
       
   133 			)
       
   134 		);
       
   135 
       
   136 		// This theme uses its own gallery styles.
       
   137 		add_filter( 'use_default_gallery_style', '__return_false' );
       
   138 
       
   139 		// Indicate widget sidebars can use selective refresh in the Customizer.
       
   140 		add_theme_support( 'customize-selective-refresh-widgets' );
       
   141 	}
   117 endif; // twentyfourteen_setup
   142 endif; // twentyfourteen_setup
   118 add_action( 'after_setup_theme', 'twentyfourteen_setup' );
   143 add_action( 'after_setup_theme', 'twentyfourteen_setup' );
   119 
   144 
   120 /**
   145 /**
   121  * Adjust content_width value for image attachment template.
   146  * Adjust content_width value for image attachment template.
   165  */
   190  */
   166 function twentyfourteen_widgets_init() {
   191 function twentyfourteen_widgets_init() {
   167 	require get_template_directory() . '/inc/widgets.php';
   192 	require get_template_directory() . '/inc/widgets.php';
   168 	register_widget( 'Twenty_Fourteen_Ephemera_Widget' );
   193 	register_widget( 'Twenty_Fourteen_Ephemera_Widget' );
   169 
   194 
   170 	register_sidebar( array(
   195 	register_sidebar(
   171 		'name'          => __( 'Primary Sidebar', 'twentyfourteen' ),
   196 		array(
   172 		'id'            => 'sidebar-1',
   197 			'name'          => __( 'Primary Sidebar', 'twentyfourteen' ),
   173 		'description'   => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ),
   198 			'id'            => 'sidebar-1',
   174 		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   199 			'description'   => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ),
   175 		'after_widget'  => '</aside>',
   200 			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   176 		'before_title'  => '<h1 class="widget-title">',
   201 			'after_widget'  => '</aside>',
   177 		'after_title'   => '</h1>',
   202 			'before_title'  => '<h1 class="widget-title">',
   178 	) );
   203 			'after_title'   => '</h1>',
   179 	register_sidebar( array(
   204 		)
   180 		'name'          => __( 'Content Sidebar', 'twentyfourteen' ),
   205 	);
   181 		'id'            => 'sidebar-2',
   206 	register_sidebar(
   182 		'description'   => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ),
   207 		array(
   183 		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   208 			'name'          => __( 'Content Sidebar', 'twentyfourteen' ),
   184 		'after_widget'  => '</aside>',
   209 			'id'            => 'sidebar-2',
   185 		'before_title'  => '<h1 class="widget-title">',
   210 			'description'   => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ),
   186 		'after_title'   => '</h1>',
   211 			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   187 	) );
   212 			'after_widget'  => '</aside>',
   188 	register_sidebar( array(
   213 			'before_title'  => '<h1 class="widget-title">',
   189 		'name'          => __( 'Footer Widget Area', 'twentyfourteen' ),
   214 			'after_title'   => '</h1>',
   190 		'id'            => 'sidebar-3',
   215 		)
   191 		'description'   => __( 'Appears in the footer section of the site.', 'twentyfourteen' ),
   216 	);
   192 		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
   217 	register_sidebar(
   193 		'after_widget'  => '</aside>',
   218 		array(
   194 		'before_title'  => '<h1 class="widget-title">',
   219 			'name'          => __( 'Footer Widget Area', 'twentyfourteen' ),
   195 		'after_title'   => '</h1>',
   220 			'id'            => 'sidebar-3',
   196 	) );
   221 			'description'   => __( 'Appears in the footer section of the site.', 'twentyfourteen' ),
       
   222 			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
       
   223 			'after_widget'  => '</aside>',
       
   224 			'before_title'  => '<h1 class="widget-title">',
       
   225 			'after_title'   => '</h1>',
       
   226 		)
       
   227 	);
   197 }
   228 }
   198 add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
   229 add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
   199 
   230 
   200 /**
   231 /**
   201  * Register Lato Google font for Twenty Fourteen.
   232  * Register Lato Google font for Twenty Fourteen.
   213 	if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
   244 	if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
   214 		$query_args = array(
   245 		$query_args = array(
   215 			'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ),
   246 			'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ),
   216 			'subset' => urlencode( 'latin,latin-ext' ),
   247 			'subset' => urlencode( 'latin,latin-ext' ),
   217 		);
   248 		);
   218 		$font_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
   249 		$font_url   = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
   219 	}
   250 	}
   220 
   251 
   221 	return $font_url;
   252 	return $font_url;
   222 }
   253 }
   223 
   254 
   252 		wp_enqueue_script( 'jquery-masonry' );
   283 		wp_enqueue_script( 'jquery-masonry' );
   253 	}
   284 	}
   254 
   285 
   255 	if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
   286 	if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
   256 		wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
   287 		wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
   257 		wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array(
   288 		wp_localize_script(
   258 			'prevText' => __( 'Previous', 'twentyfourteen' ),
   289 			'twentyfourteen-slider', 'featuredSliderDefaults', array(
   259 			'nextText' => __( 'Next', 'twentyfourteen' )
   290 				'prevText' => __( 'Previous', 'twentyfourteen' ),
   260 		) );
   291 				'nextText' => __( 'Next', 'twentyfourteen' ),
       
   292 			)
       
   293 		);
   261 	}
   294 	}
   262 
   295 
   263 	wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true );
   296 	wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true );
   264 }
   297 }
   265 add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
   298 add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
   272 function twentyfourteen_admin_fonts() {
   305 function twentyfourteen_admin_fonts() {
   273 	wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
   306 	wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
   274 }
   307 }
   275 add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
   308 add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
   276 
   309 
       
   310 /**
       
   311  * Add preconnect for Google Fonts.
       
   312  *
       
   313  * @since Twenty Fourteen 1.9
       
   314  *
       
   315  * @param array   $urls          URLs to print for resource hints.
       
   316  * @param string  $relation_type The relation type the URLs are printed.
       
   317  * @return array URLs to print for resource hints.
       
   318  */
       
   319 function twentyfourteen_resource_hints( $urls, $relation_type ) {
       
   320 	if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) {
       
   321 		if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
       
   322 			$urls[] = array(
       
   323 				'href' => 'https://fonts.gstatic.com',
       
   324 				'crossorigin',
       
   325 			);
       
   326 		} else {
       
   327 			$urls[] = 'https://fonts.gstatic.com';
       
   328 		}
       
   329 	}
       
   330 
       
   331 	return $urls;
       
   332 }
       
   333 add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 );
       
   334 
   277 if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
   335 if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
   278 /**
       
   279  * Print the attached image with a link to the next attached image.
       
   280  *
       
   281  * @since Twenty Fourteen 1.0
       
   282  */
       
   283 function twentyfourteen_the_attached_image() {
       
   284 	$post                = get_post();
       
   285 	/**
   336 	/**
   286 	 * Filter the default Twenty Fourteen attachment size.
   337 	 * Print the attached image with a link to the next attached image.
   287 	 *
   338 	 *
   288 	 * @since Twenty Fourteen 1.0
   339 	 * @since Twenty Fourteen 1.0
   289 	 *
       
   290 	 * @param array $dimensions {
       
   291 	 *     An array of height and width dimensions.
       
   292 	 *
       
   293 	 *     @type int $height Height of the image in pixels. Default 810.
       
   294 	 *     @type int $width  Width of the image in pixels. Default 810.
       
   295 	 * }
       
   296 	 */
   340 	 */
   297 	$attachment_size     = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) );
   341 	function twentyfourteen_the_attached_image() {
   298 	$next_attachment_url = wp_get_attachment_url();
   342 		$post = get_post();
   299 
   343 		/**
   300 	/*
   344 		 * Filter the default Twenty Fourteen attachment size.
   301 	 * Grab the IDs of all the image attachments in a gallery so we can get the URL
   345 		 *
   302 	 * of the next adjacent image in a gallery, or the first image (if we're
   346 		 * @since Twenty Fourteen 1.0
   303 	 * looking at the last image in a gallery), or, in a gallery of one, just the
   347 		 *
   304 	 * link to that image file.
   348 		 * @param array $dimensions {
   305 	 */
   349 		 *     An array of height and width dimensions.
   306 	$attachment_ids = get_posts( array(
   350 		 *
   307 		'post_parent'    => $post->post_parent,
   351 		 *     @type int $height Height of the image in pixels. Default 810.
   308 		'fields'         => 'ids',
   352 		 *     @type int $width  Width of the image in pixels. Default 810.
   309 		'numberposts'    => -1,
   353 		 * }
   310 		'post_status'    => 'inherit',
   354 		 */
   311 		'post_type'      => 'attachment',
   355 		$attachment_size     = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) );
   312 		'post_mime_type' => 'image',
   356 		$next_attachment_url = wp_get_attachment_url();
   313 		'order'          => 'ASC',
   357 
   314 		'orderby'        => 'menu_order ID',
   358 		/*
   315 	) );
   359 		 * Grab the IDs of all the image attachments in a gallery so we can get the URL
   316 
   360 		 * of the next adjacent image in a gallery, or the first image (if we're
   317 	// If there is more than 1 attachment in a gallery...
   361 		 * looking at the last image in a gallery), or, in a gallery of one, just the
   318 	if ( count( $attachment_ids ) > 1 ) {
   362 		 * link to that image file.
   319 		foreach ( $attachment_ids as $attachment_id ) {
   363 		 */
   320 			if ( $attachment_id == $post->ID ) {
   364 		$attachment_ids = get_posts(
   321 				$next_id = current( $attachment_ids );
   365 			array(
   322 				break;
   366 				'post_parent'    => $post->post_parent,
       
   367 				'fields'         => 'ids',
       
   368 				'numberposts'    => -1,
       
   369 				'post_status'    => 'inherit',
       
   370 				'post_type'      => 'attachment',
       
   371 				'post_mime_type' => 'image',
       
   372 				'order'          => 'ASC',
       
   373 				'orderby'        => 'menu_order ID',
       
   374 			)
       
   375 		);
       
   376 
       
   377 		// If there is more than 1 attachment in a gallery...
       
   378 		if ( count( $attachment_ids ) > 1 ) {
       
   379 			foreach ( $attachment_ids as $idx => $attachment_id ) {
       
   380 				if ( $attachment_id == $post->ID ) {
       
   381 					$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
       
   382 					break;
       
   383 				}
       
   384 			}
       
   385 
       
   386 			// get the URL of the next image attachment...
       
   387 			if ( $next_id ) {
       
   388 				$next_attachment_url = get_attachment_link( $next_id );
       
   389 			} // or get the URL of the first image attachment.
       
   390 			else {
       
   391 				$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
   323 			}
   392 			}
   324 		}
   393 		}
   325 
   394 
   326 		// get the URL of the next image attachment...
   395 		printf(
   327 		if ( $next_id ) {
   396 			'<a href="%1$s" rel="attachment">%2$s</a>',
   328 			$next_attachment_url = get_attachment_link( $next_id );
   397 			esc_url( $next_attachment_url ),
   329 		}
   398 			wp_get_attachment_image( $post->ID, $attachment_size )
   330 
   399 		);
   331 		// or get the URL of the first image attachment.
   400 	}
   332 		else {
       
   333 			$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
       
   334 		}
       
   335 	}
       
   336 
       
   337 	printf( '<a href="%1$s" rel="attachment">%2$s</a>',
       
   338 		esc_url( $next_attachment_url ),
       
   339 		wp_get_attachment_image( $post->ID, $attachment_size )
       
   340 	);
       
   341 }
       
   342 endif;
   401 endif;
   343 
   402 
   344 if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
   403 if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
   345 /**
   404 	/**
   346  * Print a list of all site contributors who published at least one post.
   405 	 * Print a list of all site contributors who published at least one post.
   347  *
   406 	 *
   348  * @since Twenty Fourteen 1.0
   407 	 * @since Twenty Fourteen 1.0
   349  */
   408 	 */
   350 function twentyfourteen_list_authors() {
   409 	function twentyfourteen_list_authors() {
   351 	$contributor_ids = get_users( array(
   410 		$contributor_ids = get_users(
   352 		'fields'  => 'ID',
   411 			array(
   353 		'orderby' => 'post_count',
   412 				'fields'  => 'ID',
   354 		'order'   => 'DESC',
   413 				'orderby' => 'post_count',
   355 		'who'     => 'authors',
   414 				'order'   => 'DESC',
   356 	) );
   415 				'who'     => 'authors',
   357 
   416 			)
   358 	foreach ( $contributor_ids as $contributor_id ) :
   417 		);
   359 		$post_count = count_user_posts( $contributor_id );
   418 
   360 
   419 		foreach ( $contributor_ids as $contributor_id ) :
   361 		// Move on if user has not published a post (yet).
   420 			$post_count = count_user_posts( $contributor_id );
   362 		if ( ! $post_count ) {
   421 
   363 			continue;
   422 			// Move on if user has not published a post (yet).
   364 		}
   423 			if ( ! $post_count ) {
   365 	?>
   424 				continue;
   366 
   425 			}
   367 	<div class="contributor">
   426 		?>
       
   427 
       
   428 		<div class="contributor">
   368 		<div class="contributor-info">
   429 		<div class="contributor-info">
   369 			<div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
   430 			<div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
   370 			<div class="contributor-summary">
   431 			<div class="contributor-summary">
   371 				<h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
   432 				<h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
   372 				<p class="contributor-bio">
   433 				<p class="contributor-bio">
   379 		</div><!-- .contributor-info -->
   440 		</div><!-- .contributor-info -->
   380 	</div><!-- .contributor -->
   441 	</div><!-- .contributor -->
   381 
   442 
   382 	<?php
   443 	<?php
   383 	endforeach;
   444 	endforeach;
   384 }
   445 	}
   385 endif;
   446 endif;
   386 
   447 
   387 /**
   448 /**
   388  * Extend the default WordPress body classes.
   449  * Extend the default WordPress body classes.
   389  *
   450  *
   497 
   558 
   498 	return $title;
   559 	return $title;
   499 }
   560 }
   500 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
   561 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
   501 
   562 
       
   563 
       
   564 /**
       
   565  * Modifies tag cloud widget arguments to display all tags in the same font size
       
   566  * and use list format for better accessibility.
       
   567  *
       
   568  * @since Twenty Fourteen 2.1
       
   569  *
       
   570  * @param array $args Arguments for tag cloud widget.
       
   571  * @return array The filtered arguments for tag cloud widget.
       
   572  */
       
   573 function twentyfourteen_widget_tag_cloud_args( $args ) {
       
   574 	$args['largest']  = 22;
       
   575 	$args['smallest'] = 8;
       
   576 	$args['unit']     = 'pt';
       
   577 	$args['format']   = 'list';
       
   578 
       
   579 	return $args;
       
   580 }
       
   581 add_filter( 'widget_tag_cloud_args', 'twentyfourteen_widget_tag_cloud_args' );
       
   582 
       
   583 
   502 // Implement Custom Header features.
   584 // Implement Custom Header features.
   503 require get_template_directory() . '/inc/custom-header.php';
   585 require get_template_directory() . '/inc/custom-header.php';
   504 
   586 
   505 // Custom template tags for this theme.
   587 // Custom template tags for this theme.
   506 require get_template_directory() . '/inc/template-tags.php';
   588 require get_template_directory() . '/inc/template-tags.php';
   515  * before the 'setup_theme' hook.
   597  * before the 'setup_theme' hook.
   516  */
   598  */
   517 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
   599 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
   518 	require get_template_directory() . '/inc/featured-content.php';
   600 	require get_template_directory() . '/inc/featured-content.php';
   519 }
   601 }
       
   602 
       
   603 /**
       
   604  * Add an `is_customize_preview` function if it is missing.
       
   605  *
       
   606  * Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the
       
   607  * `is_customize_preview` function was introduced.
       
   608  */
       
   609 if ( ! function_exists( 'is_customize_preview' ) ) :
       
   610 	function is_customize_preview() {
       
   611 		global $wp_customize;
       
   612 
       
   613 		return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
       
   614 	}
       
   615 endif;