2013-07-28 18:55:10 -04:00
|
|
|
<?php
|
|
|
|
/**
|
2013-10-11 18:02:11 -04:00
|
|
|
* Twenty Fourteen functions and definitions
|
2013-08-14 23:13:44 -04:00
|
|
|
*
|
2013-10-11 18:02:11 -04:00
|
|
|
* Set up the theme and provides some helper functions, which are used in the
|
2013-08-14 23:13:44 -04:00
|
|
|
* theme as custom template tags. Others are attached to action and filter
|
|
|
|
* hooks in WordPress to change core functionality.
|
|
|
|
*
|
2013-12-03 12:06:11 -05:00
|
|
|
* 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.
|
|
|
|
*
|
2019-07-25 18:46:55 -04:00
|
|
|
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
2019-04-01 07:56:52 -04:00
|
|
|
* @link https://developer.wordpress.org/themes/advanced-topics/child-themes/
|
2013-08-14 23:13:44 -04:00
|
|
|
*
|
|
|
|
* 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,
|
2019-07-25 18:46:55 -04:00
|
|
|
* @link https://developer.wordpress.org/plugins/
|
2013-07-28 18:55:10 -04:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Twenty_Fourteen
|
2013-10-11 18:02:11 -04:00
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-10-11 18:02:11 -04:00
|
|
|
* Set up the content width value based on the theme's design.
|
|
|
|
*
|
2013-12-03 12:06:11 -05:00
|
|
|
* @see twentyfourteen_content_width()
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( ! isset( $content_width ) ) {
|
2013-08-14 23:13:44 -04:00
|
|
|
$content_width = 474;
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-11-15 16:15:10 -05:00
|
|
|
/**
|
|
|
|
* Twenty Fourteen only works in WordPress 3.6 or later.
|
|
|
|
*/
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
|
2013-11-15 16:15:10 -05:00
|
|
|
require get_template_directory() . '/inc/back-compat.php';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-11-15 16:15:10 -05:00
|
|
|
|
2013-07-28 18:55:10 -04:00
|
|
|
if ( ! function_exists( 'twentyfourteen_setup' ) ) :
|
2017-11-30 18:11:00 -05:00
|
|
|
/**
|
|
|
|
* Twenty Fourteen setup.
|
|
|
|
*
|
|
|
|
* Set up theme defaults and registers support for various WordPress features.
|
2013-08-14 23:13:44 -04:00
|
|
|
*
|
2017-11-30 18:11:00 -05:00
|
|
|
* 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 post thumbnails.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
2017-11-30 18:11:00 -05:00
|
|
|
function twentyfourteen_setup() {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make Twenty Fourteen available for translation.
|
|
|
|
*
|
|
|
|
* Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfourteen
|
|
|
|
* If you're building a theme based on Twenty Fourteen, use a find and
|
|
|
|
* replace to change 'twentyfourteen' to the name of your theme in all
|
|
|
|
* template files.
|
2023-06-16 09:04:21 -04:00
|
|
|
*
|
|
|
|
* Manual loading of text domain is not required after the introduction of
|
|
|
|
* just in time translation loading in WordPress version 4.6.
|
|
|
|
*
|
|
|
|
* @ticket 58318
|
2017-11-30 18:11:00 -05:00
|
|
|
*/
|
2023-06-16 09:04:21 -04:00
|
|
|
if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) {
|
|
|
|
load_theme_textdomain( 'twentyfourteen' );
|
|
|
|
}
|
2017-11-30 18:11:00 -05:00
|
|
|
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
/*
|
|
|
|
* This theme styles the visual editor to resemble the theme style.
|
|
|
|
* When fonts are self-hosted, the theme directory needs to be removed first.
|
|
|
|
*/
|
|
|
|
$font_stylesheet = str_replace(
|
|
|
|
array( get_template_directory_uri() . '/', get_stylesheet_directory_uri() . '/' ),
|
|
|
|
'',
|
2024-02-12 16:48:08 -05:00
|
|
|
(string) twentyfourteen_font_url()
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
);
|
|
|
|
add_editor_style( array( 'css/editor-style.css', $font_stylesheet, 'genericons/genericons.css' ) );
|
2017-11-30 18:11:00 -05:00
|
|
|
|
2018-12-13 21:04:37 -05:00
|
|
|
// Load regular editor styles into the new block-based editor.
|
|
|
|
add_theme_support( 'editor-styles' );
|
|
|
|
|
|
|
|
// Load default block styles.
|
|
|
|
add_theme_support( 'wp-block-styles' );
|
|
|
|
|
2018-12-16 22:07:04 -05:00
|
|
|
// Add support for responsive embeds.
|
|
|
|
add_theme_support( 'responsive-embeds' );
|
|
|
|
|
2018-12-13 21:04:37 -05:00
|
|
|
// Add support for custom color scheme.
|
|
|
|
add_theme_support(
|
|
|
|
'editor-color-palette',
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'name' => __( 'Green', 'twentyfourteen' ),
|
|
|
|
'slug' => 'green',
|
|
|
|
'color' => '#24890d',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __( 'Black', 'twentyfourteen' ),
|
|
|
|
'slug' => 'black',
|
|
|
|
'color' => '#000',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __( 'Dark Gray', 'twentyfourteen' ),
|
|
|
|
'slug' => 'dark-gray',
|
|
|
|
'color' => '#2b2b2b',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __( 'Medium Gray', 'twentyfourteen' ),
|
|
|
|
'slug' => 'medium-gray',
|
|
|
|
'color' => '#767676',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __( 'Light Gray', 'twentyfourteen' ),
|
|
|
|
'slug' => 'light-gray',
|
|
|
|
'color' => '#f5f5f5',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __( 'White', 'twentyfourteen' ),
|
|
|
|
'slug' => 'white',
|
|
|
|
'color' => '#fff',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// Add RSS feed links to <head> for posts and comments.
|
|
|
|
add_theme_support( 'automatic-feed-links' );
|
|
|
|
|
|
|
|
// Enable support for Post Thumbnails, and declare two sizes.
|
|
|
|
add_theme_support( 'post-thumbnails' );
|
|
|
|
set_post_thumbnail_size( 672, 372, true );
|
|
|
|
add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
|
|
|
|
|
|
|
|
// This theme uses wp_nav_menu() in two locations.
|
|
|
|
register_nav_menus(
|
|
|
|
array(
|
|
|
|
'primary' => __( 'Top primary menu', 'twentyfourteen' ),
|
|
|
|
'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
/*
|
|
|
|
* Switch default core markup for search form, comment form, and comments
|
|
|
|
* to output valid HTML5.
|
|
|
|
*/
|
|
|
|
add_theme_support(
|
2018-08-16 21:51:36 -04:00
|
|
|
'html5',
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'search-form',
|
|
|
|
'comment-form',
|
|
|
|
'comment-list',
|
|
|
|
'gallery',
|
|
|
|
'caption',
|
2019-09-18 10:51:56 -04:00
|
|
|
'script',
|
|
|
|
'style',
|
2020-10-19 16:32:05 -04:00
|
|
|
'navigation-widgets',
|
2017-11-30 18:11:00 -05:00
|
|
|
)
|
|
|
|
);
|
2013-09-02 19:03:09 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
/*
|
|
|
|
* Enable support for Post Formats.
|
2024-03-11 10:00:12 -04:00
|
|
|
* See: https://developer.wordpress.org/advanced-administration/wordpress/post-formats/
|
2017-11-30 18:11:00 -05:00
|
|
|
*/
|
|
|
|
add_theme_support(
|
2018-08-16 21:51:36 -04:00
|
|
|
'post-formats',
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'aside',
|
|
|
|
'image',
|
|
|
|
'video',
|
|
|
|
'audio',
|
|
|
|
'quote',
|
|
|
|
'link',
|
|
|
|
'gallery',
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// This theme allows users to set a custom background.
|
|
|
|
add_theme_support(
|
2018-08-16 21:51:36 -04:00
|
|
|
'custom-background',
|
2020-07-01 09:52:01 -04:00
|
|
|
/**
|
2020-08-10 20:34:08 -04:00
|
|
|
* Filters Twenty Fourteen custom-background support arguments.
|
2020-07-01 09:52:01 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
|
|
|
* @param array $args {
|
|
|
|
* An array of custom-background support arguments.
|
|
|
|
*
|
|
|
|
* @type string $default-color Default color of the background.
|
|
|
|
* }
|
|
|
|
*/
|
2018-08-16 21:51:36 -04:00
|
|
|
apply_filters(
|
|
|
|
'twentyfourteen_custom_background_args',
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'default-color' => 'f5f5f5',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// Add support for featured content.
|
|
|
|
add_theme_support(
|
2018-08-16 21:51:36 -04:00
|
|
|
'featured-content',
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'featured_content_filter' => 'twentyfourteen_get_featured_posts',
|
|
|
|
'max_posts' => 6,
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// This theme uses its own gallery styles.
|
|
|
|
add_filter( 'use_default_gallery_style', '__return_false' );
|
2013-08-22 13:01:08 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// Indicate widget sidebars can use selective refresh in the Customizer.
|
|
|
|
add_theme_support( 'customize-selective-refresh-widgets' );
|
|
|
|
}
|
2020-01-28 19:45:18 -05:00
|
|
|
endif; // twentyfourteen_setup()
|
2013-07-28 18:55:10 -04:00
|
|
|
add_action( 'after_setup_theme', 'twentyfourteen_setup' );
|
|
|
|
|
|
|
|
/**
|
2013-10-24 18:57:34 -04:00
|
|
|
* Adjust content_width value for image attachment template.
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-08-14 23:13:44 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_content_width() {
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_attachment() && wp_attachment_is_image() ) {
|
2013-09-20 14:22:09 -04:00
|
|
|
$GLOBALS['content_width'] = 810;
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-08-14 23:13:44 -04:00
|
|
|
}
|
|
|
|
add_action( 'template_redirect', 'twentyfourteen_content_width' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Getter function for Featured Content Plugin.
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-10-16 00:22:09 -04:00
|
|
|
*
|
|
|
|
* @return array An array of WP_Post objects.
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_get_featured_posts() {
|
2013-12-03 12:06:11 -05:00
|
|
|
/**
|
2020-08-10 20:34:08 -04:00
|
|
|
* Filters the featured posts to return in Twenty Fourteen.
|
2013-12-03 12:06:11 -05:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
|
|
|
* @param array|bool $posts Array of featured posts, otherwise false.
|
|
|
|
*/
|
2013-10-16 00:22:09 -04:00
|
|
|
return apply_filters( 'twentyfourteen_get_featured_posts', array() );
|
2013-07-28 18:55:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-16 00:22:09 -04:00
|
|
|
* A helper conditional function that returns a boolean value.
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-10-16 00:22:09 -04:00
|
|
|
*
|
|
|
|
* @return bool Whether there are featured posts.
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
2013-10-16 00:22:09 -04:00
|
|
|
function twentyfourteen_has_featured_posts() {
|
2013-12-03 12:28:10 -05:00
|
|
|
return ! is_paged() && (bool) twentyfourteen_get_featured_posts();
|
2013-07-28 18:55:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-12-03 12:06:11 -05:00
|
|
|
* Register three Twenty Fourteen widget areas.
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_widgets_init() {
|
2013-08-22 14:06:09 -04:00
|
|
|
require get_template_directory() . '/inc/widgets.php';
|
|
|
|
register_widget( 'Twenty_Fourteen_Ephemera_Widget' );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
register_sidebar(
|
|
|
|
array(
|
|
|
|
'name' => __( 'Primary Sidebar', 'twentyfourteen' ),
|
|
|
|
'id' => 'sidebar-1',
|
|
|
|
'description' => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ),
|
|
|
|
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
|
|
|
'after_widget' => '</aside>',
|
|
|
|
'before_title' => '<h1 class="widget-title">',
|
|
|
|
'after_title' => '</h1>',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
register_sidebar(
|
|
|
|
array(
|
|
|
|
'name' => __( 'Content Sidebar', 'twentyfourteen' ),
|
|
|
|
'id' => 'sidebar-2',
|
|
|
|
'description' => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ),
|
|
|
|
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
|
|
|
'after_widget' => '</aside>',
|
|
|
|
'before_title' => '<h1 class="widget-title">',
|
|
|
|
'after_title' => '</h1>',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
register_sidebar(
|
|
|
|
array(
|
|
|
|
'name' => __( 'Footer Widget Area', 'twentyfourteen' ),
|
|
|
|
'id' => 'sidebar-3',
|
|
|
|
'description' => __( 'Appears in the footer section of the site.', 'twentyfourteen' ),
|
|
|
|
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
|
|
|
|
'after_widget' => '</aside>',
|
|
|
|
'before_title' => '<h1 class="widget-title">',
|
|
|
|
'after_title' => '</h1>',
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
}
|
|
|
|
add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
|
|
|
|
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
if ( ! function_exists( 'twentyfourteen_font_url' ) ) :
|
|
|
|
/**
|
|
|
|
* Register Lato font for Twenty Fourteen.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
* @since Twenty Fourteen 3.6 Replaced Google URL with self-hosted fonts.
|
|
|
|
*
|
|
|
|
* @return string
|
2013-09-02 19:03:09 -04:00
|
|
|
*/
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
function twentyfourteen_font_url() {
|
|
|
|
$font_url = '';
|
|
|
|
/*
|
|
|
|
* translators: If there are characters in your language that are not supported
|
|
|
|
* by Lato, translate this to 'off'. Do not translate into your own language.
|
|
|
|
*/
|
|
|
|
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
|
|
|
|
$font_url = get_template_directory_uri() . '/fonts/font-lato.css';
|
|
|
|
}
|
2013-09-02 19:03:09 -04:00
|
|
|
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
return $font_url;
|
|
|
|
}
|
|
|
|
endif;
|
2013-07-28 18:55:10 -04:00
|
|
|
|
|
|
|
/**
|
2013-12-03 12:06:11 -05:00
|
|
|
* Enqueue scripts and styles for the front end.
|
2013-10-11 18:02:11 -04:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_scripts() {
|
2013-08-20 14:10:08 -04:00
|
|
|
// Add Lato font, used in the main stylesheet.
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
|
|
|
|
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version );
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-08-20 14:10:08 -04:00
|
|
|
// Add Genericons font, used in the main stylesheet.
|
2014-06-06 13:36:14 -04:00
|
|
|
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
|
2013-08-20 14:10:08 -04:00
|
|
|
|
2013-11-11 23:18:11 -05:00
|
|
|
// Load our main stylesheet.
|
2024-07-15 10:32:10 -04:00
|
|
|
wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri(), array(), '20240716' );
|
2013-08-20 14:10:08 -04:00
|
|
|
|
2018-12-13 21:04:37 -05:00
|
|
|
// Theme block stylesheet.
|
2024-07-15 10:32:10 -04:00
|
|
|
wp_enqueue_style( 'twentyfourteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfourteen-style' ), '20240613' );
|
2018-12-13 21:04:37 -05:00
|
|
|
|
2013-11-11 23:18:11 -05:00
|
|
|
// Load the Internet Explorer specific stylesheet.
|
2022-10-11 13:05:13 -04:00
|
|
|
wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20140711' );
|
2013-11-15 16:15:10 -05:00
|
|
|
wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' );
|
2013-11-11 23:18:11 -05:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
2013-07-28 18:55:10 -04:00
|
|
|
wp_enqueue_script( 'comment-reply' );
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_singular() && wp_attachment_is_image() ) {
|
2019-08-07 21:29:58 -04:00
|
|
|
wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20150120' );
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_active_sidebar( 'sidebar-3' ) ) {
|
2013-08-20 13:53:09 -04:00
|
|
|
wp_enqueue_script( 'jquery-masonry' );
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-08-20 13:53:09 -04:00
|
|
|
|
2020-05-16 14:42:12 -04:00
|
|
|
if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
|
2023-09-11 20:06:19 -04:00
|
|
|
wp_enqueue_script(
|
|
|
|
'twentyfourteen-slider',
|
|
|
|
get_template_directory_uri() . '/js/slider.js',
|
|
|
|
array( 'jquery' ),
|
|
|
|
'20150120',
|
|
|
|
array(
|
|
|
|
'in_footer' => false, // Because involves header.
|
|
|
|
'strategy' => 'defer',
|
|
|
|
)
|
|
|
|
);
|
2017-11-30 18:11:00 -05:00
|
|
|
wp_localize_script(
|
2018-08-16 21:51:36 -04:00
|
|
|
'twentyfourteen-slider',
|
|
|
|
'featuredSliderDefaults',
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'prevText' => __( 'Previous', 'twentyfourteen' ),
|
|
|
|
'nextText' => __( 'Next', 'twentyfourteen' ),
|
|
|
|
)
|
|
|
|
);
|
2013-11-09 18:28:09 -05:00
|
|
|
}
|
2013-09-02 19:03:09 -04:00
|
|
|
|
2023-09-11 20:06:19 -04:00
|
|
|
wp_enqueue_script(
|
|
|
|
'twentyfourteen-script',
|
|
|
|
get_template_directory_uri() . '/js/functions.js',
|
|
|
|
array( 'jquery' ),
|
|
|
|
'20230526',
|
|
|
|
array(
|
|
|
|
'in_footer' => false, // Because involves header.
|
|
|
|
'strategy' => 'defer',
|
|
|
|
)
|
|
|
|
);
|
2013-07-28 18:55:10 -04:00
|
|
|
}
|
|
|
|
add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
|
|
|
|
|
|
|
|
/**
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
* Enqueue font stylesheet to admin screen for custom header display.
|
2013-07-28 18:55:10 -04:00
|
|
|
*
|
2013-10-11 18:02:11 -04:00
|
|
|
* @since Twenty Fourteen 1.0
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
2013-08-14 23:13:29 -04:00
|
|
|
function twentyfourteen_admin_fonts() {
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
|
|
|
|
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version );
|
2013-07-28 18:55:10 -04:00
|
|
|
}
|
2013-08-14 23:13:29 -04:00
|
|
|
add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2016-10-22 21:56:32 -04:00
|
|
|
/**
|
|
|
|
* Add preconnect for Google Fonts.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.9
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
* @deprecated Twenty Fourteen 3.6 Disabled filter because, by default, fonts are self-hosted.
|
2016-10-22 21:56:32 -04:00
|
|
|
*
|
|
|
|
* @param array $urls URLs to print for resource hints.
|
|
|
|
* @param string $relation_type The relation type the URLs are printed.
|
|
|
|
* @return array URLs to print for resource hints.
|
|
|
|
*/
|
|
|
|
function twentyfourteen_resource_hints( $urls, $relation_type ) {
|
|
|
|
if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) {
|
|
|
|
if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
|
|
|
|
$urls[] = array(
|
|
|
|
'href' => 'https://fonts.gstatic.com',
|
|
|
|
'crossorigin',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$urls[] = 'https://fonts.gstatic.com';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $urls;
|
|
|
|
}
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
// add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 );
|
2016-10-22 21:56:32 -04:00
|
|
|
|
2018-12-13 21:04:37 -05:00
|
|
|
/**
|
2018-12-18 22:30:41 -05:00
|
|
|
* Enqueue styles for the block-based editor.
|
2018-12-13 21:04:37 -05:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 2.3
|
|
|
|
*/
|
|
|
|
function twentyfourteen_block_editor_styles() {
|
|
|
|
// Block styles.
|
2024-07-15 10:32:10 -04:00
|
|
|
wp_enqueue_style( 'twentyfourteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20240613' );
|
2018-12-13 21:04:37 -05:00
|
|
|
// Add custom fonts.
|
Twenty Fourteen: Bundle Google Fonts locally.
This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.
Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.
Built from https://develop.svn.wordpress.org/trunk@55270
git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 10:59:23 -05:00
|
|
|
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
|
|
|
|
wp_enqueue_style( 'twentyfourteen-fonts', twentyfourteen_font_url(), array(), $font_version );
|
2018-12-13 21:04:37 -05:00
|
|
|
}
|
|
|
|
add_action( 'enqueue_block_editor_assets', 'twentyfourteen_block_editor_styles' );
|
|
|
|
|
2013-08-14 23:13:29 -04:00
|
|
|
if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
|
2013-12-03 12:06:11 -05:00
|
|
|
/**
|
2017-11-30 18:11:00 -05:00
|
|
|
* Print the attached image with a link to the next attached image.
|
2013-12-03 12:06:11 -05:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*/
|
2017-11-30 18:11:00 -05:00
|
|
|
function twentyfourteen_the_attached_image() {
|
|
|
|
$post = get_post();
|
|
|
|
/**
|
2020-08-10 20:34:08 -04:00
|
|
|
* Filters the default Twenty Fourteen attachment size.
|
2017-11-30 18:11:00 -05:00
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
|
|
|
* @param array $dimensions {
|
|
|
|
* An array of height and width dimensions.
|
|
|
|
*
|
|
|
|
* @type int $height Height of the image in pixels. Default 810.
|
|
|
|
* @type int $width Width of the image in pixels. Default 810.
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
$attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) );
|
|
|
|
$next_attachment_url = wp_get_attachment_url();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Grab the IDs of all the image attachments in a gallery so we can get the URL
|
|
|
|
* of the next adjacent image in a gallery, or the first image (if we're
|
|
|
|
* looking at the last image in a gallery), or, in a gallery of one, just the
|
|
|
|
* link to that image file.
|
|
|
|
*/
|
|
|
|
$attachment_ids = get_posts(
|
|
|
|
array(
|
|
|
|
'post_parent' => $post->post_parent,
|
|
|
|
'fields' => 'ids',
|
|
|
|
'numberposts' => -1,
|
|
|
|
'post_status' => 'inherit',
|
|
|
|
'post_type' => 'attachment',
|
|
|
|
'post_mime_type' => 'image',
|
|
|
|
'order' => 'ASC',
|
|
|
|
'orderby' => 'menu_order ID',
|
|
|
|
)
|
|
|
|
);
|
2013-08-14 23:13:29 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
// If there is more than 1 attachment in a gallery...
|
|
|
|
if ( count( $attachment_ids ) > 1 ) {
|
|
|
|
foreach ( $attachment_ids as $idx => $attachment_id ) {
|
2023-02-24 01:23:23 -05:00
|
|
|
if ( $attachment_id === $post->ID ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
|
|
|
|
break;
|
|
|
|
}
|
2013-08-14 23:13:29 -04:00
|
|
|
}
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $next_id ) {
|
2020-01-28 19:45:18 -05:00
|
|
|
// ...get the URL of the next image attachment.
|
2017-11-30 18:11:00 -05:00
|
|
|
$next_attachment_url = get_attachment_link( $next_id );
|
2019-01-11 01:40:50 -05:00
|
|
|
} else {
|
2020-01-28 19:45:18 -05:00
|
|
|
// ...or get the URL of the first image attachment.
|
2017-11-30 18:11:00 -05:00
|
|
|
$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
|
|
|
|
}
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-08-14 23:13:29 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
printf(
|
|
|
|
'<a href="%1$s" rel="attachment">%2$s</a>',
|
|
|
|
esc_url( $next_attachment_url ),
|
|
|
|
wp_get_attachment_image( $post->ID, $attachment_size )
|
|
|
|
);
|
2013-08-14 23:13:29 -04:00
|
|
|
}
|
|
|
|
endif;
|
|
|
|
|
2013-09-19 17:33:09 -04:00
|
|
|
if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
|
2017-11-30 18:11:00 -05:00
|
|
|
/**
|
|
|
|
* Print a list of all site contributors who published at least one post.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*/
|
|
|
|
function twentyfourteen_list_authors() {
|
Role/Capability: Add support for capability queries in `WP_User_Query`.
Similar to the existing `role`/`role__in`/`role__not_in` query arguments, this adds support for three new query arguments in `WP_User_Query`:
* `capability`
* `capability__in`
* `capability__not_in`
These can be used to fetch users with (or without) a specific set of capabilities, for example to get all users
with the capability to edit a certain post type.
Under the hood, this will check all existing roles on the site and perform a `LIKE` query against the `capabilities` user meta field to find:
* all users with a role that has this capability
* all users with the capability being assigned directly
Note: In WordPress, not all capabilities are stored in the database. Capabilities can also be modified using filters like `map_meta_cap`. These new query arguments do NOT work for such capabilities.
The prime use case for capability queries is to get all "authors", i.e. users with the capability to edit a certain post type.
Until now, `'who' => 'authors'` was used for this, which relies on user levels. However, user levels were deprecated a long time ago and thus never added to custom roles. This led to constant frustration due to users with custom roles missing from places like author dropdowns.
This updates any usage of `'who' => 'authors'` in core to use capability queries instead.
Subsequently, `'who' => 'authors'` queries are being **deprecated** in favor of these new query arguments.
Also adds a new `capabilities` parameter (mapping to `capability__in` in `WP_User_Query`) to the REST API users controller.
Also updates `twentyfourteen_list_authors()` in Twenty Fourteen to make use of this new functionality, adding a new `twentyfourteen_list_authors_query_args` filter to make it easier to override this behavior.
Props scribu, lgladdly, boonebgorges, spacedmonkey, peterwilsoncc, SergeyBiryukov, swissspidy.
Fixes #16841.
Built from https://develop.svn.wordpress.org/trunk@51943
git-svn-id: http://core.svn.wordpress.org/trunk@51532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-27 14:43:57 -04:00
|
|
|
$args = array(
|
|
|
|
'fields' => 'ID',
|
|
|
|
'orderby' => 'post_count',
|
|
|
|
'order' => 'DESC',
|
|
|
|
'capability' => array( 'edit_posts' ),
|
2017-11-30 18:11:00 -05:00
|
|
|
);
|
2013-09-19 17:33:09 -04:00
|
|
|
|
2021-11-30 14:25:01 -05:00
|
|
|
// Capability queries were only introduced in WP 5.9.
|
|
|
|
if ( version_compare( $GLOBALS['wp_version'], '5.9-alpha', '<' ) ) {
|
|
|
|
$args['who'] = 'authors';
|
|
|
|
unset( $args['capability'] );
|
|
|
|
}
|
|
|
|
|
Role/Capability: Add support for capability queries in `WP_User_Query`.
Similar to the existing `role`/`role__in`/`role__not_in` query arguments, this adds support for three new query arguments in `WP_User_Query`:
* `capability`
* `capability__in`
* `capability__not_in`
These can be used to fetch users with (or without) a specific set of capabilities, for example to get all users
with the capability to edit a certain post type.
Under the hood, this will check all existing roles on the site and perform a `LIKE` query against the `capabilities` user meta field to find:
* all users with a role that has this capability
* all users with the capability being assigned directly
Note: In WordPress, not all capabilities are stored in the database. Capabilities can also be modified using filters like `map_meta_cap`. These new query arguments do NOT work for such capabilities.
The prime use case for capability queries is to get all "authors", i.e. users with the capability to edit a certain post type.
Until now, `'who' => 'authors'` was used for this, which relies on user levels. However, user levels were deprecated a long time ago and thus never added to custom roles. This led to constant frustration due to users with custom roles missing from places like author dropdowns.
This updates any usage of `'who' => 'authors'` in core to use capability queries instead.
Subsequently, `'who' => 'authors'` queries are being **deprecated** in favor of these new query arguments.
Also adds a new `capabilities` parameter (mapping to `capability__in` in `WP_User_Query`) to the REST API users controller.
Also updates `twentyfourteen_list_authors()` in Twenty Fourteen to make use of this new functionality, adding a new `twentyfourteen_list_authors_query_args` filter to make it easier to override this behavior.
Props scribu, lgladdly, boonebgorges, spacedmonkey, peterwilsoncc, SergeyBiryukov, swissspidy.
Fixes #16841.
Built from https://develop.svn.wordpress.org/trunk@51943
git-svn-id: http://core.svn.wordpress.org/trunk@51532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-27 14:43:57 -04:00
|
|
|
/**
|
|
|
|
* Filters query arguments for listing authors.
|
|
|
|
*
|
2023-10-04 08:14:24 -04:00
|
|
|
* @since Twenty Fourteen 3.3
|
Role/Capability: Add support for capability queries in `WP_User_Query`.
Similar to the existing `role`/`role__in`/`role__not_in` query arguments, this adds support for three new query arguments in `WP_User_Query`:
* `capability`
* `capability__in`
* `capability__not_in`
These can be used to fetch users with (or without) a specific set of capabilities, for example to get all users
with the capability to edit a certain post type.
Under the hood, this will check all existing roles on the site and perform a `LIKE` query against the `capabilities` user meta field to find:
* all users with a role that has this capability
* all users with the capability being assigned directly
Note: In WordPress, not all capabilities are stored in the database. Capabilities can also be modified using filters like `map_meta_cap`. These new query arguments do NOT work for such capabilities.
The prime use case for capability queries is to get all "authors", i.e. users with the capability to edit a certain post type.
Until now, `'who' => 'authors'` was used for this, which relies on user levels. However, user levels were deprecated a long time ago and thus never added to custom roles. This led to constant frustration due to users with custom roles missing from places like author dropdowns.
This updates any usage of `'who' => 'authors'` in core to use capability queries instead.
Subsequently, `'who' => 'authors'` queries are being **deprecated** in favor of these new query arguments.
Also adds a new `capabilities` parameter (mapping to `capability__in` in `WP_User_Query`) to the REST API users controller.
Also updates `twentyfourteen_list_authors()` in Twenty Fourteen to make use of this new functionality, adding a new `twentyfourteen_list_authors_query_args` filter to make it easier to override this behavior.
Props scribu, lgladdly, boonebgorges, spacedmonkey, peterwilsoncc, SergeyBiryukov, swissspidy.
Fixes #16841.
Built from https://develop.svn.wordpress.org/trunk@51943
git-svn-id: http://core.svn.wordpress.org/trunk@51532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-27 14:43:57 -04:00
|
|
|
*
|
|
|
|
* @param array $args Query arguments.
|
|
|
|
*/
|
|
|
|
$args = apply_filters( 'twentyfourteen_list_authors_query_args', $args );
|
|
|
|
|
|
|
|
$contributor_ids = get_users( $args );
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
foreach ( $contributor_ids as $contributor_id ) :
|
|
|
|
$post_count = count_user_posts( $contributor_id );
|
|
|
|
|
|
|
|
// Move on if user has not published a post (yet).
|
|
|
|
if ( ! $post_count ) {
|
|
|
|
continue;
|
|
|
|
}
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2017-11-30 18:11:00 -05:00
|
|
|
|
|
|
|
<div class="contributor">
|
2013-10-30 10:39:10 -04:00
|
|
|
<div class="contributor-info">
|
2013-09-20 14:22:09 -04:00
|
|
|
<div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
|
|
|
|
<div class="contributor-summary">
|
|
|
|
<h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
|
|
|
|
<p class="contributor-bio">
|
|
|
|
<?php echo get_the_author_meta( 'description', $contributor_id ); ?>
|
|
|
|
</p>
|
2014-03-06 14:54:15 -05:00
|
|
|
<a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
|
2019-07-08 21:10:00 -04:00
|
|
|
<?php
|
2019-09-02 20:41:05 -04:00
|
|
|
/* translators: %d: Post count. */
|
2019-07-08 21:10:00 -04:00
|
|
|
printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count );
|
|
|
|
?>
|
2013-09-20 14:22:09 -04:00
|
|
|
</a>
|
|
|
|
</div><!-- .contributor-summary -->
|
|
|
|
</div><!-- .contributor-info -->
|
2013-09-19 17:33:09 -04:00
|
|
|
</div><!-- .contributor -->
|
|
|
|
|
2018-08-16 21:51:36 -04:00
|
|
|
<?php
|
2013-09-19 17:33:09 -04:00
|
|
|
endforeach;
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2013-09-19 17:33:09 -04:00
|
|
|
endif;
|
|
|
|
|
2013-07-28 18:55:10 -04:00
|
|
|
/**
|
2013-10-11 18:02:11 -04:00
|
|
|
* Extend the default WordPress body classes.
|
2013-08-14 23:13:44 -04:00
|
|
|
*
|
|
|
|
* Adds body classes to denote:
|
|
|
|
* 1. Single or multiple authors.
|
2014-07-11 15:04:13 -04:00
|
|
|
* 2. Presence of header image except in Multisite signup and activate pages.
|
2013-10-30 10:39:10 -04:00
|
|
|
* 3. Index views.
|
|
|
|
* 4. Full-width content layout.
|
|
|
|
* 5. Presence of footer widgets.
|
|
|
|
* 6. Single views.
|
|
|
|
* 7. Featured content layout.
|
2013-07-28 18:55:10 -04:00
|
|
|
*
|
2013-10-11 18:02:11 -04:00
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
2013-08-14 23:13:44 -04:00
|
|
|
* @param array $classes A list of existing body class values.
|
|
|
|
* @return array The filtered body class list.
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_body_classes( $classes ) {
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_multi_author() ) {
|
2013-07-28 18:55:10 -04:00
|
|
|
$classes[] = 'group-blog';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-09-20 14:22:09 -04:00
|
|
|
|
2016-11-14 12:17:31 -05:00
|
|
|
if ( get_header_image() ) {
|
2013-10-24 18:58:48 -04:00
|
|
|
$classes[] = 'header-image';
|
2020-04-04 23:02:11 -04:00
|
|
|
} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ), true ) ) {
|
2013-10-24 18:58:48 -04:00
|
|
|
$classes[] = 'masthead-fixed';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-10-24 18:58:48 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_archive() || is_search() || is_home() ) {
|
2013-07-28 18:55:10 -04:00
|
|
|
$classes[] = 'list-view';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-09-20 14:22:09 -04:00
|
|
|
|
2013-10-10 23:17:11 -04:00
|
|
|
if ( ( ! is_active_sidebar( 'sidebar-2' ) )
|
2013-11-12 14:03:09 -05:00
|
|
|
|| is_page_template( 'page-templates/full-width.php' )
|
|
|
|
|| is_page_template( 'page-templates/contributors.php' )
|
2013-11-18 18:11:10 -05:00
|
|
|
|| is_attachment() ) {
|
2013-09-20 14:22:09 -04:00
|
|
|
$classes[] = 'full-width';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_active_sidebar( 'sidebar-3' ) ) {
|
2013-10-08 17:37:09 -04:00
|
|
|
$classes[] = 'footer-widgets';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-10-08 17:37:09 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_singular() && ! is_front_page() ) {
|
2013-10-30 10:39:10 -04:00
|
|
|
$classes[] = 'singular';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-10-30 10:39:10 -04:00
|
|
|
|
2020-05-16 14:42:12 -04:00
|
|
|
if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
|
2013-10-30 10:39:10 -04:00
|
|
|
$classes[] = 'slider';
|
2013-11-18 18:11:10 -05:00
|
|
|
} elseif ( is_front_page() ) {
|
2013-10-30 10:39:10 -04:00
|
|
|
$classes[] = 'grid';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-10-30 10:39:10 -04:00
|
|
|
|
2013-07-28 18:55:10 -04:00
|
|
|
return $classes;
|
|
|
|
}
|
|
|
|
add_filter( 'body_class', 'twentyfourteen_body_classes' );
|
|
|
|
|
2014-03-19 16:49:15 -04:00
|
|
|
/**
|
|
|
|
* Extend the default WordPress post classes.
|
|
|
|
*
|
|
|
|
* Adds a post class to denote:
|
|
|
|
* Non-password protected page with a post thumbnail.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
|
|
|
* @param array $classes A list of existing post class values.
|
|
|
|
* @return array The filtered post class list.
|
|
|
|
*/
|
|
|
|
function twentyfourteen_post_classes( $classes ) {
|
|
|
|
if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) {
|
|
|
|
$classes[] = 'has-post-thumbnail';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $classes;
|
|
|
|
}
|
|
|
|
add_filter( 'post_class', 'twentyfourteen_post_classes' );
|
|
|
|
|
2013-07-28 18:55:10 -04:00
|
|
|
/**
|
2013-10-11 18:02:11 -04:00
|
|
|
* Create a nicely formatted and more specific title element text for output
|
2013-08-14 23:13:44 -04:00
|
|
|
* in head of document, based on current view.
|
2013-07-28 18:55:10 -04:00
|
|
|
*
|
2013-10-11 18:02:11 -04:00
|
|
|
* @since Twenty Fourteen 1.0
|
|
|
|
*
|
2014-06-04 13:15:15 -04:00
|
|
|
* @global int $paged WordPress archive pagination page count.
|
|
|
|
* @global int $page WordPress paginated post page count.
|
|
|
|
*
|
2013-08-14 23:13:44 -04:00
|
|
|
* @param string $title Default title text for current view.
|
|
|
|
* @param string $sep Optional separator.
|
|
|
|
* @return string The filtered title.
|
2013-07-28 18:55:10 -04:00
|
|
|
*/
|
|
|
|
function twentyfourteen_wp_title( $title, $sep ) {
|
2013-08-14 23:13:44 -04:00
|
|
|
global $paged, $page;
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( is_feed() ) {
|
2013-07-28 18:55:10 -04:00
|
|
|
return $title;
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-08-14 23:13:44 -04:00
|
|
|
// Add the site name.
|
2014-02-04 08:57:12 -05:00
|
|
|
$title .= get_bloginfo( 'name', 'display' );
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-08-14 23:13:44 -04:00
|
|
|
// Add the site description for the home/front page.
|
2013-07-28 18:55:10 -04:00
|
|
|
$site_description = get_bloginfo( 'description', 'display' );
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( $site_description && ( is_home() || is_front_page() ) ) {
|
2013-08-14 23:13:44 -04:00
|
|
|
$title = "$title $sep $site_description";
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
2013-08-14 23:13:44 -04:00
|
|
|
// Add a page number if necessary.
|
2014-05-04 09:17:28 -04:00
|
|
|
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
|
2019-09-02 20:41:05 -04:00
|
|
|
/* translators: %s: Page number. */
|
2013-08-14 23:13:44 -04:00
|
|
|
$title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) );
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2013-07-28 18:55:10 -04:00
|
|
|
|
|
|
|
return $title;
|
|
|
|
}
|
2013-08-14 23:13:29 -04:00
|
|
|
add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
|
|
|
|
|
2017-10-04 19:53:47 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Modifies tag cloud widget arguments to display all tags in the same font size
|
|
|
|
* and use list format for better accessibility.
|
|
|
|
*
|
|
|
|
* @since Twenty Fourteen 2.1
|
|
|
|
*
|
|
|
|
* @param array $args Arguments for tag cloud widget.
|
|
|
|
* @return array The filtered arguments for tag cloud widget.
|
|
|
|
*/
|
|
|
|
function twentyfourteen_widget_tag_cloud_args( $args ) {
|
|
|
|
$args['largest'] = 22;
|
|
|
|
$args['smallest'] = 8;
|
|
|
|
$args['unit'] = 'pt';
|
|
|
|
$args['format'] = 'list';
|
|
|
|
|
|
|
|
return $args;
|
|
|
|
}
|
|
|
|
add_filter( 'widget_tag_cloud_args', 'twentyfourteen_widget_tag_cloud_args' );
|
|
|
|
|
|
|
|
|
2013-10-11 18:02:11 -04:00
|
|
|
// Implement Custom Header features.
|
2013-08-14 23:13:44 -04:00
|
|
|
require get_template_directory() . '/inc/custom-header.php';
|
|
|
|
|
2013-10-11 18:02:11 -04:00
|
|
|
// Custom template tags for this theme.
|
2013-08-14 23:13:29 -04:00
|
|
|
require get_template_directory() . '/inc/template-tags.php';
|
|
|
|
|
2014-10-15 13:21:19 -04:00
|
|
|
// Add Customizer functionality.
|
2013-08-14 23:13:29 -04:00
|
|
|
require get_template_directory() . '/inc/customizer.php';
|
2013-10-16 00:22:09 -04:00
|
|
|
|
2021-05-28 14:17:59 -04:00
|
|
|
// Add support for block patterns.
|
|
|
|
require get_template_directory() . '/inc/block-patterns.php';
|
|
|
|
|
2013-10-16 00:22:09 -04:00
|
|
|
/*
|
|
|
|
* Add Featured Content functionality.
|
|
|
|
*
|
|
|
|
* To overwrite in a plugin, define your own Featured_Content class on or
|
|
|
|
* before the 'setup_theme' hook.
|
|
|
|
*/
|
2013-11-18 18:11:10 -05:00
|
|
|
if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
|
2013-10-16 00:22:09 -04:00
|
|
|
require get_template_directory() . '/inc/featured-content.php';
|
2013-11-18 18:11:10 -05:00
|
|
|
}
|
2017-01-27 15:31:42 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an `is_customize_preview` function if it is missing.
|
|
|
|
*
|
|
|
|
* Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the
|
|
|
|
* `is_customize_preview` function was introduced.
|
2023-03-07 03:30:17 -05:00
|
|
|
*
|
|
|
|
* @global WP_Customize_Manager $wp_customize Customizer object.
|
2017-01-27 15:31:42 -05:00
|
|
|
*/
|
|
|
|
if ( ! function_exists( 'is_customize_preview' ) ) :
|
2017-11-30 18:11:00 -05:00
|
|
|
function is_customize_preview() {
|
|
|
|
global $wp_customize;
|
2017-01-27 15:31:42 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
|
|
|
|
}
|
2017-01-27 15:31:42 -05:00
|
|
|
endif;
|