wp/wp-content/themes/twentythirteen/functions.php
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 18:30:03 +0200
changeset 10 372f2766ea20
parent 7 cf61fcea0001
permissions -rw-r--r--
update themes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Twenty Thirteen functions and definitions
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * Sets up the theme and provides some helper functions, which are used in the
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * theme as custom template tags. Others are attached to action and filter
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * hooks in WordPress to change core functionality.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 *
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     9
 * When using a child theme you can override certain functions (those wrapped
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    10
 * in a function_exists() call) by defining them first in your child theme's
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    11
 * functions.php file. The child theme's functions.php file is included before
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    12
 * the parent theme's file, so the child theme functions would be used.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    13
 *
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    14
 * @link https://codex.wordpress.org/Theme_Development
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    15
 * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 * Functions that are not pluggable (not wrapped in function_exists()) are
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 * instead attached to a filter or action hook.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    20
 * For more information on hooks, actions, and filters, @link https://codex.wordpress.org/Plugin_API
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
 * @subpackage Twenty_Thirteen
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 * Set up the content width value based on the theme's design.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 * @see twentythirteen_content_width() for template-specific adjustments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    32
if ( ! isset( $content_width ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	$content_width = 604;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    34
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 * Add support for a custom header image.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
require get_template_directory() . '/inc/custom-header.php';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
 * Twenty Thirteen only works in WordPress 3.6 or later.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    44
if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
	require get_template_directory() . '/inc/back-compat.php';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    46
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 * Twenty Thirteen setup.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 * Sets up theme defaults and registers the various WordPress features that
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 * Twenty Thirteen supports.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
 * @uses load_theme_textdomain() For translation/localization support.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
 * @uses add_editor_style() To add Visual Editor stylesheets.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
 * @uses add_theme_support() To add support for automatic feed links, post
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
 * formats, and post thumbnails.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
 * @uses register_nav_menu() To add support for a navigation menu.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
function twentythirteen_setup() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
	 * Makes Twenty Thirteen available for translation.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
	 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    67
	 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentythirteen
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
	 * If you're building a theme based on Twenty Thirteen, use a find and
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
	 * replace to change 'twentythirteen' to the name of your theme in all
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
	 * template files.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    72
	load_theme_textdomain( 'twentythirteen' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
	 * This theme styles the visual editor to resemble the theme style,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	 * specifically font, colors, icons, and column width.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    78
	add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    80
	// Load regular editor styles into the new block-based editor.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    81
	add_theme_support( 'editor-styles' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    82
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    83
	// Load default block styles.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    84
	add_theme_support( 'wp-block-styles' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    85
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    86
	// Add support for full and wide align images.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    87
	add_theme_support( 'align-wide' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    88
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    89
	// Add support for responsive embeds.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    90
	add_theme_support( 'responsive-embeds' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    91
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    92
	// Add support for custom color scheme.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    93
	add_theme_support(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    94
		'editor-color-palette',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    95
		array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    96
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    97
				'name'  => __( 'Dark Gray', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    98
				'slug'  => 'dark-gray',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    99
				'color' => '#141412',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   100
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   101
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   102
				'name'  => __( 'Red', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   103
				'slug'  => 'red',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   104
				'color' => '#bc360a',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   105
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   106
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   107
				'name'  => __( 'Medium Orange', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   108
				'slug'  => 'medium-orange',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   109
				'color' => '#db572f',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   110
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   111
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   112
				'name'  => __( 'Light Orange', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   113
				'slug'  => 'light-orange',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   114
				'color' => '#ea9629',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   115
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   116
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   117
				'name'  => __( 'Yellow', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   118
				'slug'  => 'yellow',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   119
				'color' => '#fbca3c',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   120
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   121
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   122
				'name'  => __( 'White', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   123
				'slug'  => 'white',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   124
				'color' => '#fff',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   125
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   126
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   127
				'name'  => __( 'Dark Brown', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   128
				'slug'  => 'dark-brown',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   129
				'color' => '#220e10',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   130
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   131
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   132
				'name'  => __( 'Medium Brown', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   133
				'slug'  => 'medium-brown',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   134
				'color' => '#722d19',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   135
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   136
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   137
				'name'  => __( 'Light Brown', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   138
				'slug'  => 'light-brown',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   139
				'color' => '#eadaa6',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   140
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   141
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   142
				'name'  => __( 'Beige', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   143
				'slug'  => 'beige',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   144
				'color' => '#e8e5ce',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   145
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   146
			array(
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   147
				'name'  => __( 'Off-white', 'twentythirteen' ),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   148
				'slug'  => 'off-white',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   149
				'color' => '#f7f5e7',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   150
			),
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   151
		)
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   152
	);
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   153
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
	// Adds RSS feed links to <head> for posts and comments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
	add_theme_support( 'automatic-feed-links' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
	 * Switches default core markup for search form, comment form,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
	 * and comments to output valid HTML5.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   161
	add_theme_support(
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   162
		'html5',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   163
		array(
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   164
			'search-form',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   165
			'comment-form',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   166
			'comment-list',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   167
			'gallery',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   168
			'caption',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   169
		)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   170
	);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
	 * This theme supports all available post formats by default.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   174
	 * See https://codex.wordpress.org/Post_Formats
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   176
	add_theme_support(
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   177
		'post-formats',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   178
		array(
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   179
			'aside',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   180
			'audio',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   181
			'chat',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   182
			'gallery',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   183
			'image',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   184
			'link',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   185
			'quote',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   186
			'status',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   187
			'video',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   188
		)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   189
	);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
	// This theme uses wp_nav_menu() in one location.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
	register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
	 * This theme uses a custom image size for featured images, displayed on
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
	 * "standard" posts and pages.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
	add_theme_support( 'post-thumbnails' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
	set_post_thumbnail_size( 604, 270, true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
	// This theme uses its own gallery styles.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
	add_filter( 'use_default_gallery_style', '__return_false' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   203
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   204
	// Indicate widget sidebars can use selective refresh in the Customizer.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   205
	add_theme_support( 'customize-selective-refresh-widgets' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
add_action( 'after_setup_theme', 'twentythirteen_setup' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
 * Return the Google font stylesheet URL, if available.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
 * The use of Source Sans Pro and Bitter by default is localized. For languages
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
 * that use characters not supported by the font, the font can be disabled.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
 * @return string Font stylesheet or empty string if disabled.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
function twentythirteen_fonts_url() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
	$fonts_url = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
	/* Translators: If there are characters in your language that are not
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
	 * supported by Source Sans Pro, translate this to 'off'. Do not translate
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
	 * into your own language.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
	$source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
	/* Translators: If there are characters in your language that are not
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
	 * supported by Bitter, translate this to 'off'. Do not translate into your
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
	 * own language.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
	$bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
	if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
		$font_families = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   237
		if ( 'off' !== $source_sans_pro ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
			$font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   239
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   241
		if ( 'off' !== $bitter ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
			$font_families[] = 'Bitter:400,700';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   243
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
		$query_args = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
			'family' => urlencode( implode( '|', $font_families ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
			'subset' => urlencode( 'latin,latin-ext' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
		);
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   249
		$fonts_url  = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
	return $fonts_url;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
 * Enqueue scripts and styles for the front end.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
function twentythirteen_scripts_styles() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
	 * Adds JavaScript to pages with the comment form to support
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
	 * sites with threaded comments (when in use).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   265
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
		wp_enqueue_script( 'comment-reply' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   267
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
	// Adds Masonry to handle vertical alignment of footer widgets.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   270
	if ( is_active_sidebar( 'sidebar-1' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
		wp_enqueue_script( 'jquery-masonry' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   272
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
	// Loads JavaScript file with functionality specific to Twenty Thirteen.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   275
	wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160717', true );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
	// Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
	// Add Genericons font, used in the main stylesheet.
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   281
	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
	// Loads our main stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
	wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   286
	// Theme block stylesheet.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   287
	wp_enqueue_style( 'twentythirteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentythirteen-style' ), '2018-12-30' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   288
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
	// Loads the Internet Explorer specific stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
	wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
	wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   296
 * Add preconnect for Google Fonts.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   297
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   298
 * @since Twenty Thirteen 2.1
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   299
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   300
 * @param array   $urls          URLs to print for resource hints.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   301
 * @param string  $relation_type The relation type the URLs are printed.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   302
 * @return array URLs to print for resource hints.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   303
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   304
function twentythirteen_resource_hints( $urls, $relation_type ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   305
	if ( wp_style_is( 'twentythirteen-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   306
		if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   307
			$urls[] = array(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   308
				'href' => 'https://fonts.gstatic.com',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   309
				'crossorigin',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   310
			);
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   311
		} else {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   312
			$urls[] = 'https://fonts.gstatic.com';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   313
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   314
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   315
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   316
	return $urls;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   317
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   318
add_filter( 'wp_resource_hints', 'twentythirteen_resource_hints', 10, 2 );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   319
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   320
/**
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   321
 * Enqueue styles for the block-based editor.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   322
 *
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   323
 * @since Twenty Thirteen 2.5
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   324
 */
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   325
function twentythirteen_block_editor_styles() {
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   326
	// Block styles.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   327
	wp_enqueue_style( 'twentythirteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '2018-12-30' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   328
	// Add custom fonts.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   329
	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   330
}
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   331
add_action( 'enqueue_block_editor_assets', 'twentythirteen_block_editor_styles' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   332
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   333
/**
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
 * Filter the page title.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
 * Creates a nicely formatted and more specific title element text for output
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
 * in head of document, based on current view.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
 * @param string $title Default title text for current view.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
 * @param string $sep   Optional separator.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
 * @return string The filtered title.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
function twentythirteen_wp_title( $title, $sep ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
	global $paged, $page;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   348
	if ( is_feed() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
		return $title;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   350
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
	// Add the site name.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   353
	$title .= get_bloginfo( 'name', 'display' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
	// Add the site description for the home/front page.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
	$site_description = get_bloginfo( 'description', 'display' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   357
	if ( $site_description && ( is_home() || is_front_page() ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
		$title = "$title $sep $site_description";
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   359
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
	// Add a page number if necessary.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   362
	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   364
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
	return $title;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   370
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
 * Register two widget areas.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
function twentythirteen_widgets_init() {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   376
	register_sidebar(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   377
		array(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   378
			'name'          => __( 'Main Widget Area', 'twentythirteen' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   379
			'id'            => 'sidebar-1',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   380
			'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   381
			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   382
			'after_widget'  => '</aside>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   383
			'before_title'  => '<h3 class="widget-title">',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   384
			'after_title'   => '</h3>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   385
		)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   386
	);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   388
	register_sidebar(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   389
		array(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   390
			'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   391
			'id'            => 'sidebar-2',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   392
			'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   393
			'before_widget' => '<aside id="%1$s" class="widget %2$s">',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   394
			'after_widget'  => '</aside>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   395
			'before_title'  => '<h3 class="widget-title">',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   396
			'after_title'   => '</h3>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   397
		)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   398
	);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
add_action( 'widgets_init', 'twentythirteen_widgets_init' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   403
	/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   404
	 * Display navigation to next/previous set of posts when applicable.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   405
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   406
	 * @since Twenty Thirteen 1.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   407
	 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   408
	function twentythirteen_paging_nav() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   409
		global $wp_query;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   411
		// Don't print empty markup if there's only one page.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   412
		if ( $wp_query->max_num_pages < 2 ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   413
			return;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   414
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   415
		?>
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   416
		<nav class="navigation paging-navigation" role="navigation">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
		<div class="nav-links">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
			<?php if ( get_next_posts_link() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentythirteen' ) ); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
			<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   423
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   424
			<?php if ( get_previous_posts_link() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   425
			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
			<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   427
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   428
		</div><!-- .nav-links -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   429
	</nav><!-- .navigation -->
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   430
		<?php
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   431
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   434
if ( ! function_exists( 'twentythirteen_post_nav' ) ) :
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   435
	/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   436
	 * Display navigation to next/previous post when applicable.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   437
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   438
	 * @since Twenty Thirteen 1.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   439
	 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   440
	function twentythirteen_post_nav() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   441
		global $post;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   443
		// Don't print empty markup if there's nowhere to navigate.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   444
		$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   445
		$next     = get_adjacent_post( false, '', false );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   447
		if ( ! $next && ! $previous ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   448
			return;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   449
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   450
		?>
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   451
		<nav class="navigation post-navigation" role="navigation">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   452
		<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
		<div class="nav-links">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
			<?php previous_post_link( '%link', _x( '<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'twentythirteen' ) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
			<?php next_post_link( '%link', _x( '%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'twentythirteen' ) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
		</div><!-- .nav-links -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   459
	</nav><!-- .navigation -->
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   460
		<?php
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   461
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   463
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   464
if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   465
	/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   466
	 * Print HTML with meta information for current post: categories, tags, permalink, author, and date.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   467
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   468
	 * Create your own twentythirteen_entry_meta() to override in a child theme.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   469
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   470
	 * @since Twenty Thirteen 1.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   471
	 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   472
	function twentythirteen_entry_meta() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   473
		if ( is_sticky() && is_home() && ! is_paged() ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   474
			echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   475
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   476
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   477
		if ( ! has_post_format( 'link' ) && 'post' == get_post_type() ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   478
			twentythirteen_entry_date();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   479
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   480
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   481
		// Translators: used between list items, there is a space after the comma.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   482
		$categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   483
		if ( $categories_list ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   484
			echo '<span class="categories-links">' . $categories_list . '</span>';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   485
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   486
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   487
		// Translators: used between list items, there is a space after the comma.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   488
		$tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   489
		if ( $tag_list ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   490
			echo '<span class="tags-links">' . $tag_list . '</span>';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   491
		}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   492
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   493
		// Post author
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   494
		if ( 'post' == get_post_type() ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   495
			printf(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   496
				'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   497
				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   498
				esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   499
				get_the_author()
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   500
			);
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   501
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   504
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
if ( ! function_exists( 'twentythirteen_entry_date' ) ) :
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   506
	/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   507
	 * Print HTML with date information for current post.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   508
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   509
	 * Create your own twentythirteen_entry_date() to override in a child theme.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   510
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   511
	 * @since Twenty Thirteen 1.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   512
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   513
	 * @param boolean $echo (optional) Whether to echo the date. Default true.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   514
	 * @return string The HTML-formatted post date.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   515
	 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   516
	function twentythirteen_entry_date( $echo = true ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   517
		if ( has_post_format( array( 'chat', 'status' ) ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   518
			$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   519
		} else {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   520
			$format_prefix = '%2$s';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   521
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   522
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   523
		$date = sprintf(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   524
			'<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   525
			esc_url( get_permalink() ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   526
			esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   527
			esc_attr( get_the_date( 'c' ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   528
			esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   529
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   530
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   531
		if ( $echo ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   532
			echo $date;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   533
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   534
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   535
		return $date;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   536
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   537
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   538
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   539
if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   541
	 * Print the attached image with a link to the next attached image.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   542
	 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   543
	 * @since Twenty Thirteen 1.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   544
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   545
	function twentythirteen_the_attached_image() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   546
		/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   547
		 * Filter the image attachment size to use.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   548
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   549
		 * @since Twenty thirteen 1.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   550
		 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   551
		 * @param array $size {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   552
		 *     @type int The attachment height in pixels.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   553
		 *     @type int The attachment width in pixels.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   554
		 * }
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   555
		 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   556
		$attachment_size     = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   557
		$next_attachment_url = wp_get_attachment_url();
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   558
		$post                = get_post();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   559
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   560
		/*
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   561
		 * Grab the IDs of all the image attachments in a gallery so we can get the URL
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   562
		 * of the next adjacent image in a gallery, or the first image (if we're
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   563
		 * looking at the last image in a gallery), or, in a gallery of one, just the
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   564
		 * link to that image file.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   565
		 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   566
		$attachment_ids = get_posts(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   567
			array(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   568
				'post_parent'    => $post->post_parent,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   569
				'fields'         => 'ids',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   570
				'numberposts'    => -1,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   571
				'post_status'    => 'inherit',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   572
				'post_type'      => 'attachment',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   573
				'post_mime_type' => 'image',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   574
				'order'          => 'ASC',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   575
				'orderby'        => 'menu_order ID',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   576
			)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   577
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   578
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   579
		// If there is more than 1 attachment in a gallery...
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   580
		if ( count( $attachment_ids ) > 1 ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   581
			foreach ( $attachment_ids as $idx => $attachment_id ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   582
				if ( $attachment_id == $post->ID ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   583
					$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   584
					break;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   585
				}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   586
			}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   587
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   588
			// get the URL of the next image attachment...
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   589
			if ( $next_id ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   590
				$next_attachment_url = get_attachment_link( $next_id );
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   591
			} else {
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   592
				// or get the URL of the first image attachment.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   593
				$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   594
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   595
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   596
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   597
		printf(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   598
			'<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   599
			esc_url( $next_attachment_url ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   600
			the_title_attribute( array( 'echo' => false ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   601
			wp_get_attachment_image( $post->ID, $attachment_size )
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   602
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   603
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   604
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   605
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   606
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   607
 * Return the post URL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   608
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
 * @uses get_url_in_content() to get the URL in the post meta (if it exists) or
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
 * the first link found in the post content.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   612
 * Falls back to the post permalink if no URL is found in the post.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   613
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
 * @return string The Link format URL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
function twentythirteen_get_link_url() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
	$content = get_the_content();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   620
	$has_url = get_url_in_content( $content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   621
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   622
	return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   623
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   624
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   625
if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   626
	/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   627
	 * Replaces "[...]" (appended to automatically generated excerpts) with ...
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   628
	 * and a Continue reading link.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   629
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   630
	 * @since Twenty Thirteen 1.4
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   631
	 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   632
	 * @param string $more Default Read More excerpt link.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   633
	 * @return string Filtered Read More excerpt link.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   634
	 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   635
	function twentythirteen_excerpt_more( $more ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   636
		$link = sprintf(
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   637
			'<a href="%1$s" class="more-link">%2$s</a>',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   638
			esc_url( get_permalink( get_the_ID() ) ),
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   639
			/* translators: %s: Name of current post */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   640
			sprintf( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   641
		);
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   642
		return ' &hellip; ' . $link;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   643
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   644
	add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   645
endif;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   646
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   647
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   648
 * Extend the default WordPress body classes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   649
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   650
 * Adds body classes to denote:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   651
 * 1. Single or multiple authors.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   652
 * 2. Active widgets in the sidebar to change the layout and spacing.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   653
 * 3. When avatars are disabled in discussion settings.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   654
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   655
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   656
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   657
 * @param array $classes A list of existing body class values.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   658
 * @return array The filtered body class list.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   659
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   660
function twentythirteen_body_class( $classes ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   661
	if ( ! is_multi_author() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   662
		$classes[] = 'single-author';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   663
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   664
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   665
	if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   666
		$classes[] = 'sidebar';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   667
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   668
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   669
	if ( ! get_option( 'show_avatars' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   670
		$classes[] = 'no-avatars';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   671
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   672
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   673
	return $classes;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   674
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   675
add_filter( 'body_class', 'twentythirteen_body_class' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   676
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   677
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   678
 * Adjust content_width value for video post formats and attachment templates.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   679
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   680
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   681
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   682
function twentythirteen_content_width() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   683
	global $content_width;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   684
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   685
	if ( is_attachment() ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   686
		$content_width = 724;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   687
	} elseif ( has_post_format( 'audio' ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   688
		$content_width = 484;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   689
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   690
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   691
add_action( 'template_redirect', 'twentythirteen_content_width' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   692
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   694
 * Add postMessage support for site title and description for the Customizer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   695
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   696
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   697
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
 * @param WP_Customize_Manager $wp_customize Customizer object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   700
function twentythirteen_customize_register( $wp_customize ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   704
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   705
	if ( isset( $wp_customize->selective_refresh ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   706
		$wp_customize->selective_refresh->add_partial(
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   707
			'blogname',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   708
			array(
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   709
				'selector'            => '.site-title',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   710
				'container_inclusive' => false,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   711
				'render_callback'     => 'twentythirteen_customize_partial_blogname',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   712
			)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   713
		);
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   714
		$wp_customize->selective_refresh->add_partial(
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   715
			'blogdescription',
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   716
			array(
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   717
				'selector'            => '.site-description',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   718
				'container_inclusive' => false,
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   719
				'render_callback'     => 'twentythirteen_customize_partial_blogdescription',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   720
			)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   721
		);
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   722
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   723
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   724
add_action( 'customize_register', 'twentythirteen_customize_register' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   725
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   726
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   727
 * Render the site title for the selective refresh partial.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   728
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   729
 * @since Twenty Thirteen 1.9
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   730
 * @see twentythirteen_customize_register()
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   731
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   732
 * @return void
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   733
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   734
function twentythirteen_customize_partial_blogname() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   735
	bloginfo( 'name' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   736
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   737
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   738
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   739
 * Render the site tagline for the selective refresh partial.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   740
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   741
 * @since Twenty Thirteen 1.9
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   742
 * @see twentythirteen_customize_register()
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   743
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   744
 * @return void
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   745
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   746
function twentythirteen_customize_partial_blogdescription() {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   747
	bloginfo( 'description' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   748
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   749
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   750
/**
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   751
 * Enqueue Javascript postMessage handlers for the Customizer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   752
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   753
 * Binds JavaScript handlers to make the Customizer preview
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   754
 * reload changes asynchronously.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   755
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   756
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   757
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   758
function twentythirteen_customize_preview_js() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   759
	wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   760
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   761
add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   762
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   763
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   764
 * Modifies tag cloud widget arguments to display all tags in the same font size
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   765
 * and use list format for better accessibility.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   766
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   767
 * @since Twenty Thirteen 2.3
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   768
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   769
 * @param array $args Arguments for tag cloud widget.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   770
 * @return array The filtered arguments for tag cloud widget.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   771
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   772
function twentythirteen_widget_tag_cloud_args( $args ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   773
	$args['largest']  = 22;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   774
	$args['smallest'] = 8;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   775
	$args['unit']     = 'pt';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   776
	$args['format']   = 'list';
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   777
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   778
	return $args;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   779
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   780
add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
10
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   781
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   782
if ( ! function_exists( 'wp_body_open' ) ) :
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   783
	/**
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   784
	 * Fire the wp_body_open action.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   785
	 *
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   786
	 * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   787
	 *
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   788
	 * @since Twenty Thirteen 2.8
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   789
	 */
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   790
	function wp_body_open() {
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   791
		/**
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   792
		 * Triggered after the opening <body> tag.
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   793
		 *
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   794
		 * @since Twenty Thirteen 2.8
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   795
		 */
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   796
		do_action( 'wp_body_open' );
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   797
	}
372f2766ea20 update themes
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   798
endif;