wp/wp-content/themes/twentythirteen/functions.php
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
upgrade wordpress + plugins
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
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     9
 * When using a child theme (see https://codex.wordpress.org/Theme_Development
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    10
 * and https://codex.wordpress.org/Child_Themes), you can override certain
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * functions (those wrapped in a function_exists() call) by defining them first
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 * in your child theme's functions.php file. The child theme's functions.php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 * file is included before the parent theme's file, so the child theme
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
 * functions would be used.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
 * Functions that are not pluggable (not wrapped in function_exists()) are
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 * instead attached to a filter or action hook.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    19
 * 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
    20
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 * @subpackage Twenty_Thirteen
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
 */
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
 * Set up the content width value based on the theme's design.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 * @see twentythirteen_content_width() for template-specific adjustments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
if ( ! isset( $content_width ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
	$content_width = 604;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 * Add support for a custom header image.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
require get_template_directory() . '/inc/custom-header.php';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
 * Twenty Thirteen only works in WordPress 3.6 or later.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
	require get_template_directory() . '/inc/back-compat.php';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
 * Twenty Thirteen setup.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
 * Sets up theme defaults and registers the various WordPress features that
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 * Twenty Thirteen supports.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 * @uses load_theme_textdomain() For translation/localization support.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 * @uses add_editor_style() To add Visual Editor stylesheets.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
 * @uses add_theme_support() To add support for automatic feed links, post
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
 * formats, and post thumbnails.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
 * @uses register_nav_menu() To add support for a navigation menu.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
function twentythirteen_setup() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	 * Makes Twenty Thirteen available for translation.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
	 * Translations can be added to the /languages/ directory.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
	 * 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
    66
	 * replace to change 'twentythirteen' to the name of your theme in all
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
	 * template files.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
	load_theme_textdomain( 'twentythirteen', get_template_directory() . '/languages' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
	 * This theme styles the visual editor to resemble the theme style,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
	 * specifically font, colors, icons, and column width.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    75
	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
    76
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
	// Adds RSS feed links to <head> for posts and comments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
	add_theme_support( 'automatic-feed-links' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
	 * Switches default core markup for search form, comment form,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	 * and comments to output valid HTML5.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
	 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    84
	add_theme_support( 'html5', array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    85
		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    86
	) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
	 * This theme supports all available post formats by default.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    90
	 * See https://codex.wordpress.org/Post_Formats
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
	add_theme_support( 'post-formats', array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
		'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
	// This theme uses wp_nav_menu() in one location.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
	register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
	 * This theme uses a custom image size for featured images, displayed on
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
	 * "standard" posts and pages.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
	add_theme_support( 'post-thumbnails' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
	set_post_thumbnail_size( 604, 270, true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
	// This theme uses its own gallery styles.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
	add_filter( 'use_default_gallery_style', '__return_false' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
add_action( 'after_setup_theme', 'twentythirteen_setup' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
 * Return the Google font stylesheet URL, if available.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
 * 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
   115
 * that use characters not supported by the font, the font can be disabled.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
 * @return string Font stylesheet or empty string if disabled.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
function twentythirteen_fonts_url() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
	$fonts_url = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
	/* Translators: If there are characters in your language that are not
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
	 * supported by Source Sans Pro, translate this to 'off'. Do not translate
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
	 * into your own language.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
	$source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
	/* Translators: If there are characters in your language that are not
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
	 * supported by Bitter, translate this to 'off'. Do not translate into your
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	 * own language.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
	$bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
	if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
		$font_families = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
		if ( 'off' !== $source_sans_pro )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
			$font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
		if ( 'off' !== $bitter )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
			$font_families[] = 'Bitter:400,700';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
		$query_args = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
			'family' => urlencode( implode( '|', $font_families ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
			'subset' => urlencode( 'latin,latin-ext' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
		);
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   149
		$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
	return $fonts_url;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
 * Enqueue scripts and styles for the front end.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
function twentythirteen_scripts_styles() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
	 * Adds JavaScript to pages with the comment form to support
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
	 * sites with threaded comments (when in use).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
		wp_enqueue_script( 'comment-reply' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
	// Adds Masonry to handle vertical alignment of footer widgets.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	if ( is_active_sidebar( 'sidebar-1' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
		wp_enqueue_script( 'jquery-masonry' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
	// Loads JavaScript file with functionality specific to Twenty Thirteen.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   173
	wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
	// Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
	// Add Genericons font, used in the main stylesheet.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   179
	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
	// Loads our main stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
	wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
	// Loads the Internet Explorer specific stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
	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
   186
	wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
 * Filter the page title.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
 * Creates a nicely formatted and more specific title element text for output
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
 * in head of document, based on current view.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
 * @param string $title Default title text for current view.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
 * @param string $sep   Optional separator.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
 * @return string The filtered title.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
function twentythirteen_wp_title( $title, $sep ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
	global $paged, $page;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
	if ( is_feed() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
		return $title;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
	// Add the site name.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   209
	$title .= get_bloginfo( 'name', 'display' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
	// Add the site description for the home/front page.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
	$site_description = get_bloginfo( 'description', 'display' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
	if ( $site_description && ( is_home() || is_front_page() ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
		$title = "$title $sep $site_description";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
	// Add a page number if necessary.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   217
	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
	return $title;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
 * Register two widget areas.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
function twentythirteen_widgets_init() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
	register_sidebar( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
		'name'          => __( 'Main Widget Area', 'twentythirteen' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
		'id'            => 'sidebar-1',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
		'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
		'after_widget'  => '</aside>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
		'before_title'  => '<h3 class="widget-title">',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
		'after_title'   => '</h3>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
	register_sidebar( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
		'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
		'id'            => 'sidebar-2',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
		'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
		'after_widget'  => '</aside>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
		'before_title'  => '<h3 class="widget-title">',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
		'after_title'   => '</h3>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
add_action( 'widgets_init', 'twentythirteen_widgets_init' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
 * Display navigation to next/previous set of posts when applicable.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
function twentythirteen_paging_nav() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
	global $wp_query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
	// Don't print empty markup if there's only one page.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
	if ( $wp_query->max_num_pages < 2 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
		return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
	<nav class="navigation paging-navigation" role="navigation">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
		<div class="nav-links">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
			<?php if ( get_next_posts_link() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
			<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
   271
			<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
			<?php if ( get_previous_posts_link() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
			<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
   275
			<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
		</div><!-- .nav-links -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
	</nav><!-- .navigation -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
if ( ! function_exists( 'twentythirteen_post_nav' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
 * Display navigation to next/previous post when applicable.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
* @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
*/
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
function twentythirteen_post_nav() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
	global $post;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
	// Don't print empty markup if there's nowhere to navigate.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
	$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
	$next     = get_adjacent_post( false, '', false );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
	if ( ! $next && ! $previous )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
		return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
	<nav class="navigation post-navigation" role="navigation">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
		<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
		<div class="nav-links">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
			<?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
   304
			<?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
   305
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
		</div><!-- .nav-links -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
	</nav><!-- .navigation -->
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
 * Print HTML with meta information for current post: categories, tags, permalink, author, and date.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
 * Create your own twentythirteen_entry_meta() to override in a child theme.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
function twentythirteen_entry_meta() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
	if ( is_sticky() && is_home() && ! is_paged() )
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   322
		echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
	if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
		twentythirteen_entry_date();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
	// Translators: used between list items, there is a space after the comma.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
	$categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
	if ( $categories_list ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
		echo '<span class="categories-links">' . $categories_list . '</span>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
	// Translators: used between list items, there is a space after the comma.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
	$tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
	if ( $tag_list ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
		echo '<span class="tags-links">' . $tag_list . '</span>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
	// Post author
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
	if ( 'post' == get_post_type() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
		printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
			esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
			get_the_author()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
		);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
if ( ! function_exists( 'twentythirteen_entry_date' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
 * Print HTML with date information for current post.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
 * Create your own twentythirteen_entry_date() to override in a child theme.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   357
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
 * @param boolean $echo (optional) Whether to echo the date. Default true.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   359
 * @return string The HTML-formatted post date.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
function twentythirteen_entry_date( $echo = true ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
	if ( has_post_format( array( 'chat', 'status' ) ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
		$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
	else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
		$format_prefix = '%2$s';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
	$date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
		esc_url( get_permalink() ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
		esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   370
		esc_attr( get_the_date( 'c' ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
		esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
	if ( $echo )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
		echo $date;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   376
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
	return $date;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   378
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   381
if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   382
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   383
 * Print the attached image with a link to the next attached image.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   385
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
function twentythirteen_the_attached_image() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
	 * Filter the image attachment size to use.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   390
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   391
	 * @since Twenty thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   393
	 * @param array $size {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
	 *     @type int The attachment height in pixels.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
	 *     @type int The attachment width in pixels.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
	 * }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
	$attachment_size     = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
	$next_attachment_url = wp_get_attachment_url();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
	$post                = get_post();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
	/*
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   403
	 * Grab the IDs of all the image attachments in a gallery so we can get the URL
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   404
	 * of the next adjacent image in a gallery, or the first image (if we're
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   405
	 * looking at the last image in a gallery), or, in a gallery of one, just the
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   406
	 * link to that image file.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   407
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   408
	$attachment_ids = get_posts( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   409
		'post_parent'    => $post->post_parent,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
		'fields'         => 'ids',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
		'numberposts'    => -1,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
		'post_status'    => 'inherit',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
		'post_type'      => 'attachment',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
		'post_mime_type' => 'image',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
		'order'          => 'ASC',
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   416
		'orderby'        => 'menu_order ID',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
	// If there is more than 1 attachment in a gallery...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
	if ( count( $attachment_ids ) > 1 ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
		foreach ( $attachment_ids as $attachment_id ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
			if ( $attachment_id == $post->ID ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   423
				$next_id = current( $attachment_ids );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   424
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   425
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   427
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   428
		// get the URL of the next image attachment...
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   429
		if ( $next_id )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   430
			$next_attachment_url = get_attachment_link( $next_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   431
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
		// or get the URL of the first image attachment.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
		else
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   434
			$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   435
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   436
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   437
	printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   438
		esc_url( $next_attachment_url ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   439
		the_title_attribute( array( 'echo' => false ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   440
		wp_get_attachment_image( $post->ID, $attachment_size )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   441
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   445
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
 * Return the post URL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   447
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   448
 * @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
   449
 * the first link found in the post content.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
 * 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
   452
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
 * @return string The Link format URL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
function twentythirteen_get_link_url() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
	$content = get_the_content();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   459
	$has_url = get_url_in_content( $content );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   461
	return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   463
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   464
if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   465
/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   466
 * Replaces "[...]" (appended to automatically generated excerpts) with ...
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   467
 * and a Continue reading link.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   468
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   469
 * @since Twenty Thirteen 1.4
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   470
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   471
 * @param string $more Default Read More excerpt link.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   472
 * @return string Filtered Read More excerpt link.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   473
 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   474
function twentythirteen_excerpt_more( $more ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   475
	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   476
		esc_url( get_permalink( get_the_ID() ) ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   477
			/* translators: %s: Name of current post */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   478
			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
   479
		);
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   480
	return ' &hellip; ' . $link;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   481
}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   482
add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   483
endif;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   484
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   485
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   486
 * Extend the default WordPress body classes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   487
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   488
 * Adds body classes to denote:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   489
 * 1. Single or multiple authors.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   490
 * 2. Active widgets in the sidebar to change the layout and spacing.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   491
 * 3. When avatars are disabled in discussion settings.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   492
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   493
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   494
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   495
 * @param array $classes A list of existing body class values.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   496
 * @return array The filtered body class list.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   497
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   498
function twentythirteen_body_class( $classes ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   499
	if ( ! is_multi_author() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   500
		$classes[] = 'single-author';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   501
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
	if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
		$classes[] = 'sidebar';
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 ( ! get_option( 'show_avatars' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
		$classes[] = 'no-avatars';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   508
	return $classes;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
add_filter( 'body_class', 'twentythirteen_body_class' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   511
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   512
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   513
 * Adjust content_width value for video post formats and attachment templates.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   514
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   515
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   516
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   517
function twentythirteen_content_width() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   518
	global $content_width;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   519
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   520
	if ( is_attachment() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   521
		$content_width = 724;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   522
	elseif ( has_post_format( 'audio' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   523
		$content_width = 484;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   524
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   525
add_action( 'template_redirect', 'twentythirteen_content_width' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   526
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   527
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   528
 * Add postMessage support for site title and description for the Customizer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   529
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   530
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   531
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   532
 * @param WP_Customize_Manager $wp_customize Customizer object.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   533
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   534
function twentythirteen_customize_register( $wp_customize ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   535
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   536
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   537
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   538
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   539
add_action( 'customize_register', 'twentythirteen_customize_register' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   541
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   542
 * Enqueue Javascript postMessage handlers for the Customizer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   543
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   544
 * Binds JavaScript handlers to make the Customizer preview
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   545
 * reload changes asynchronously.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   546
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   547
 * @since Twenty Thirteen 1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   548
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   549
function twentythirteen_customize_preview_js() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   550
	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
   551
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   552
add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );