author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:30:03 +0200 | |
changeset 10 | 372f2766ea20 |
parent 7 | cf61fcea0001 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Twenty Thirteen functions and definitions |
|
4 |
* |
|
5 |
* Sets up the theme and provides some helper functions, which are used in the |
|
6 |
* theme as custom template tags. Others are attached to action and filter |
|
7 |
* hooks in WordPress to change core functionality. |
|
8 |
* |
|
10 | 9 |
* When using a child theme you can override certain functions (those wrapped |
10 |
* in a function_exists() call) by defining them first in your child theme's |
|
11 |
* functions.php file. The child theme's functions.php file is included before |
|
12 |
* the parent theme's file, so the child theme functions would be used. |
|
13 |
* |
|
14 |
* @link https://codex.wordpress.org/Theme_Development |
|
15 |
* @link https://developer.wordpress.org/themes/advanced-topics/child-themes/ |
|
0 | 16 |
* |
17 |
* Functions that are not pluggable (not wrapped in function_exists()) are |
|
18 |
* instead attached to a filter or action hook. |
|
19 |
* |
|
5 | 20 |
* For more information on hooks, actions, and filters, @link https://codex.wordpress.org/Plugin_API |
0 | 21 |
* |
22 |
* @package WordPress |
|
23 |
* @subpackage Twenty_Thirteen |
|
24 |
* @since Twenty Thirteen 1.0 |
|
25 |
*/ |
|
26 |
||
27 |
/* |
|
28 |
* Set up the content width value based on the theme's design. |
|
29 |
* |
|
30 |
* @see twentythirteen_content_width() for template-specific adjustments. |
|
31 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
if ( ! isset( $content_width ) ) { |
0 | 33 |
$content_width = 604; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
} |
0 | 35 |
|
36 |
/** |
|
37 |
* Add support for a custom header image. |
|
38 |
*/ |
|
39 |
require get_template_directory() . '/inc/custom-header.php'; |
|
40 |
||
41 |
/** |
|
42 |
* Twenty Thirteen only works in WordPress 3.6 or later. |
|
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 | 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 | 47 |
|
48 |
/** |
|
49 |
* Twenty Thirteen setup. |
|
50 |
* |
|
51 |
* Sets up theme defaults and registers the various WordPress features that |
|
52 |
* Twenty Thirteen supports. |
|
53 |
* |
|
54 |
* @uses load_theme_textdomain() For translation/localization support. |
|
55 |
* @uses add_editor_style() To add Visual Editor stylesheets. |
|
56 |
* @uses add_theme_support() To add support for automatic feed links, post |
|
57 |
* formats, and post thumbnails. |
|
58 |
* @uses register_nav_menu() To add support for a navigation menu. |
|
59 |
* @uses set_post_thumbnail_size() To set a custom post thumbnail size. |
|
60 |
* |
|
61 |
* @since Twenty Thirteen 1.0 |
|
62 |
*/ |
|
63 |
function twentythirteen_setup() { |
|
64 |
/* |
|
65 |
* Makes Twenty Thirteen available for translation. |
|
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 | 68 |
* If you're building a theme based on Twenty Thirteen, use a find and |
69 |
* replace to change 'twentythirteen' to the name of your theme in all |
|
70 |
* template files. |
|
71 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
load_theme_textdomain( 'twentythirteen' ); |
0 | 73 |
|
74 |
/* |
|
75 |
* This theme styles the visual editor to resemble the theme style, |
|
76 |
* specifically font, colors, icons, and column width. |
|
77 |
*/ |
|
5 | 78 |
add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) ); |
0 | 79 |
|
10 | 80 |
// Load regular editor styles into the new block-based editor. |
81 |
add_theme_support( 'editor-styles' ); |
|
82 |
||
83 |
// Load default block styles. |
|
84 |
add_theme_support( 'wp-block-styles' ); |
|
85 |
||
86 |
// Add support for full and wide align images. |
|
87 |
add_theme_support( 'align-wide' ); |
|
88 |
||
89 |
// Add support for responsive embeds. |
|
90 |
add_theme_support( 'responsive-embeds' ); |
|
91 |
||
92 |
// Add support for custom color scheme. |
|
93 |
add_theme_support( |
|
94 |
'editor-color-palette', |
|
95 |
array( |
|
96 |
array( |
|
97 |
'name' => __( 'Dark Gray', 'twentythirteen' ), |
|
98 |
'slug' => 'dark-gray', |
|
99 |
'color' => '#141412', |
|
100 |
), |
|
101 |
array( |
|
102 |
'name' => __( 'Red', 'twentythirteen' ), |
|
103 |
'slug' => 'red', |
|
104 |
'color' => '#bc360a', |
|
105 |
), |
|
106 |
array( |
|
107 |
'name' => __( 'Medium Orange', 'twentythirteen' ), |
|
108 |
'slug' => 'medium-orange', |
|
109 |
'color' => '#db572f', |
|
110 |
), |
|
111 |
array( |
|
112 |
'name' => __( 'Light Orange', 'twentythirteen' ), |
|
113 |
'slug' => 'light-orange', |
|
114 |
'color' => '#ea9629', |
|
115 |
), |
|
116 |
array( |
|
117 |
'name' => __( 'Yellow', 'twentythirteen' ), |
|
118 |
'slug' => 'yellow', |
|
119 |
'color' => '#fbca3c', |
|
120 |
), |
|
121 |
array( |
|
122 |
'name' => __( 'White', 'twentythirteen' ), |
|
123 |
'slug' => 'white', |
|
124 |
'color' => '#fff', |
|
125 |
), |
|
126 |
array( |
|
127 |
'name' => __( 'Dark Brown', 'twentythirteen' ), |
|
128 |
'slug' => 'dark-brown', |
|
129 |
'color' => '#220e10', |
|
130 |
), |
|
131 |
array( |
|
132 |
'name' => __( 'Medium Brown', 'twentythirteen' ), |
|
133 |
'slug' => 'medium-brown', |
|
134 |
'color' => '#722d19', |
|
135 |
), |
|
136 |
array( |
|
137 |
'name' => __( 'Light Brown', 'twentythirteen' ), |
|
138 |
'slug' => 'light-brown', |
|
139 |
'color' => '#eadaa6', |
|
140 |
), |
|
141 |
array( |
|
142 |
'name' => __( 'Beige', 'twentythirteen' ), |
|
143 |
'slug' => 'beige', |
|
144 |
'color' => '#e8e5ce', |
|
145 |
), |
|
146 |
array( |
|
147 |
'name' => __( 'Off-white', 'twentythirteen' ), |
|
148 |
'slug' => 'off-white', |
|
149 |
'color' => '#f7f5e7', |
|
150 |
), |
|
151 |
) |
|
152 |
); |
|
153 |
||
0 | 154 |
// Adds RSS feed links to <head> for posts and comments. |
155 |
add_theme_support( 'automatic-feed-links' ); |
|
156 |
||
157 |
/* |
|
158 |
* Switches default core markup for search form, comment form, |
|
159 |
* and comments to output valid HTML5. |
|
160 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
add_theme_support( |
10 | 162 |
'html5', |
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 | 171 |
|
172 |
/* |
|
173 |
* This theme supports all available post formats by default. |
|
5 | 174 |
* See https://codex.wordpress.org/Post_Formats |
0 | 175 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
add_theme_support( |
10 | 177 |
'post-formats', |
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 | 190 |
|
191 |
// This theme uses wp_nav_menu() in one location. |
|
192 |
register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) ); |
|
193 |
||
194 |
/* |
|
195 |
* This theme uses a custom image size for featured images, displayed on |
|
196 |
* "standard" posts and pages. |
|
197 |
*/ |
|
198 |
add_theme_support( 'post-thumbnails' ); |
|
199 |
set_post_thumbnail_size( 604, 270, true ); |
|
200 |
||
201 |
// This theme uses its own gallery styles. |
|
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 | 206 |
} |
207 |
add_action( 'after_setup_theme', 'twentythirteen_setup' ); |
|
208 |
||
209 |
/** |
|
210 |
* Return the Google font stylesheet URL, if available. |
|
211 |
* |
|
212 |
* The use of Source Sans Pro and Bitter by default is localized. For languages |
|
213 |
* that use characters not supported by the font, the font can be disabled. |
|
214 |
* |
|
215 |
* @since Twenty Thirteen 1.0 |
|
216 |
* |
|
217 |
* @return string Font stylesheet or empty string if disabled. |
|
218 |
*/ |
|
219 |
function twentythirteen_fonts_url() { |
|
220 |
$fonts_url = ''; |
|
221 |
||
222 |
/* Translators: If there are characters in your language that are not |
|
223 |
* supported by Source Sans Pro, translate this to 'off'. Do not translate |
|
224 |
* into your own language. |
|
225 |
*/ |
|
226 |
$source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' ); |
|
227 |
||
228 |
/* Translators: If there are characters in your language that are not |
|
229 |
* supported by Bitter, translate this to 'off'. Do not translate into your |
|
230 |
* own language. |
|
231 |
*/ |
|
232 |
$bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' ); |
|
233 |
||
234 |
if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) { |
|
235 |
$font_families = array(); |
|
236 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
237 |
if ( 'off' !== $source_sans_pro ) { |
0 | 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 | 240 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
241 |
if ( 'off' !== $bitter ) { |
0 | 242 |
$font_families[] = 'Bitter:400,700'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
} |
0 | 244 |
|
245 |
$query_args = array( |
|
246 |
'family' => urlencode( implode( '|', $font_families ) ), |
|
247 |
'subset' => urlencode( 'latin,latin-ext' ), |
|
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 | 250 |
} |
251 |
||
252 |
return $fonts_url; |
|
253 |
} |
|
254 |
||
255 |
/** |
|
256 |
* Enqueue scripts and styles for the front end. |
|
257 |
* |
|
258 |
* @since Twenty Thirteen 1.0 |
|
259 |
*/ |
|
260 |
function twentythirteen_scripts_styles() { |
|
261 |
/* |
|
262 |
* Adds JavaScript to pages with the comment form to support |
|
263 |
* sites with threaded comments (when in use). |
|
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 | 266 |
wp_enqueue_script( 'comment-reply' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
267 |
} |
0 | 268 |
|
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 | 271 |
wp_enqueue_script( 'jquery-masonry' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
272 |
} |
0 | 273 |
|
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 | 276 |
|
277 |
// Add Source Sans Pro and Bitter fonts, used in the main stylesheet. |
|
278 |
wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null ); |
|
279 |
||
280 |
// Add Genericons font, used in the main stylesheet. |
|
10 | 281 |
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); |
0 | 282 |
|
283 |
// Loads our main stylesheet. |
|
284 |
wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' ); |
|
285 |
||
10 | 286 |
// Theme block stylesheet. |
287 |
wp_enqueue_style( 'twentythirteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentythirteen-style' ), '2018-12-30' ); |
|
288 |
||
0 | 289 |
// Loads the Internet Explorer specific stylesheet. |
290 |
wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' ); |
|
291 |
wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' ); |
|
292 |
} |
|
293 |
add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' ); |
|
294 |
||
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 | 321 |
* Enqueue styles for the block-based editor. |
322 |
* |
|
323 |
* @since Twenty Thirteen 2.5 |
|
324 |
*/ |
|
325 |
function twentythirteen_block_editor_styles() { |
|
326 |
// Block styles. |
|
327 |
wp_enqueue_style( 'twentythirteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '2018-12-30' ); |
|
328 |
// Add custom fonts. |
|
329 |
wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null ); |
|
330 |
} |
|
331 |
add_action( 'enqueue_block_editor_assets', 'twentythirteen_block_editor_styles' ); |
|
332 |
||
333 |
/** |
|
0 | 334 |
* Filter the page title. |
335 |
* |
|
336 |
* Creates a nicely formatted and more specific title element text for output |
|
337 |
* in head of document, based on current view. |
|
338 |
* |
|
339 |
* @since Twenty Thirteen 1.0 |
|
340 |
* |
|
341 |
* @param string $title Default title text for current view. |
|
342 |
* @param string $sep Optional separator. |
|
343 |
* @return string The filtered title. |
|
344 |
*/ |
|
345 |
function twentythirteen_wp_title( $title, $sep ) { |
|
346 |
global $paged, $page; |
|
347 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
348 |
if ( is_feed() ) { |
0 | 349 |
return $title; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
} |
0 | 351 |
|
352 |
// Add the site name. |
|
5 | 353 |
$title .= get_bloginfo( 'name', 'display' ); |
0 | 354 |
|
355 |
// Add the site description for the home/front page. |
|
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 | 358 |
$title = "$title $sep $site_description"; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
359 |
} |
0 | 360 |
|
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 | 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 | 365 |
|
366 |
return $title; |
|
367 |
} |
|
368 |
add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 ); |
|
369 |
||
370 |
/** |
|
371 |
* Register two widget areas. |
|
372 |
* |
|
373 |
* @since Twenty Thirteen 1.0 |
|
374 |
*/ |
|
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 | 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 | 399 |
} |
400 |
add_action( 'widgets_init', 'twentythirteen_widgets_init' ); |
|
401 |
||
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 | 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 | 417 |
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1> |
418 |
<div class="nav-links"> |
|
419 |
||
420 |
<?php if ( get_next_posts_link() ) : ?> |
|
421 |
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentythirteen' ) ); ?></div> |
|
422 |
<?php endif; ?> |
|
423 |
||
424 |
<?php if ( get_previous_posts_link() ) : ?> |
|
425 |
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?></div> |
|
426 |
<?php endif; ?> |
|
427 |
||
428 |
</div><!-- .nav-links --> |
|
429 |
</nav><!-- .navigation --> |
|
10 | 430 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
431 |
} |
0 | 432 |
endif; |
433 |
||
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 | 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 | 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 | 452 |
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1> |
453 |
<div class="nav-links"> |
|
454 |
||
455 |
<?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'twentythirteen' ) ); ?> |
|
456 |
<?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'twentythirteen' ) ); ?> |
|
457 |
||
458 |
</div><!-- .nav-links --> |
|
459 |
</nav><!-- .navigation --> |
|
10 | 460 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
} |
0 | 462 |
endif; |
463 |
||
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 | 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 | 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 | 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 | 502 |
} |
503 |
endif; |
|
504 |
||
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 | 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 | 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 | 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 | 537 |
endif; |
538 |
||
539 |
if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) : |
|
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 | 542 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
543 |
* @since Twenty Thirteen 1.0 |
0 | 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 | 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 | 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 | 591 |
} else { |
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 | 594 |
} |
595 |
} |
|
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 | 603 |
} |
604 |
endif; |
|
605 |
||
606 |
/** |
|
607 |
* Return the post URL. |
|
608 |
* |
|
609 |
* @uses get_url_in_content() to get the URL in the post meta (if it exists) or |
|
610 |
* the first link found in the post content. |
|
611 |
* |
|
612 |
* Falls back to the post permalink if no URL is found in the post. |
|
613 |
* |
|
614 |
* @since Twenty Thirteen 1.0 |
|
615 |
* |
|
616 |
* @return string The Link format URL. |
|
617 |
*/ |
|
618 |
function twentythirteen_get_link_url() { |
|
619 |
$content = get_the_content(); |
|
620 |
$has_url = get_url_in_content( $content ); |
|
621 |
||
622 |
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); |
|
623 |
} |
|
624 |
||
5 | 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 | 639 |
/* translators: %s: Name of current post */ |
640 |
sprintf( __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' ) |
|
641 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
642 |
return ' … ' . $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 | 645 |
endif; |
646 |
||
0 | 647 |
/** |
648 |
* Extend the default WordPress body classes. |
|
649 |
* |
|
650 |
* Adds body classes to denote: |
|
651 |
* 1. Single or multiple authors. |
|
652 |
* 2. Active widgets in the sidebar to change the layout and spacing. |
|
653 |
* 3. When avatars are disabled in discussion settings. |
|
654 |
* |
|
655 |
* @since Twenty Thirteen 1.0 |
|
656 |
* |
|
657 |
* @param array $classes A list of existing body class values. |
|
658 |
* @return array The filtered body class list. |
|
659 |
*/ |
|
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 | 662 |
$classes[] = 'single-author'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
663 |
} |
0 | 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 | 666 |
$classes[] = 'sidebar'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
667 |
} |
0 | 668 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
669 |
if ( ! get_option( 'show_avatars' ) ) { |
0 | 670 |
$classes[] = 'no-avatars'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
671 |
} |
0 | 672 |
|
673 |
return $classes; |
|
674 |
} |
|
675 |
add_filter( 'body_class', 'twentythirteen_body_class' ); |
|
676 |
||
677 |
/** |
|
678 |
* Adjust content_width value for video post formats and attachment templates. |
|
679 |
* |
|
680 |
* @since Twenty Thirteen 1.0 |
|
681 |
*/ |
|
682 |
function twentythirteen_content_width() { |
|
683 |
global $content_width; |
|
684 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
685 |
if ( is_attachment() ) { |
0 | 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 | 688 |
$content_width = 484; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
689 |
} |
0 | 690 |
} |
691 |
add_action( 'template_redirect', 'twentythirteen_content_width' ); |
|
692 |
||
693 |
/** |
|
694 |
* Add postMessage support for site title and description for the Customizer. |
|
695 |
* |
|
696 |
* @since Twenty Thirteen 1.0 |
|
697 |
* |
|
698 |
* @param WP_Customize_Manager $wp_customize Customizer object. |
|
699 |
*/ |
|
700 |
function twentythirteen_customize_register( $wp_customize ) { |
|
701 |
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
702 |
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
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 | 707 |
'blogname', |
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 | 715 |
'blogdescription', |
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 | 723 |
} |
724 |
add_action( 'customize_register', 'twentythirteen_customize_register' ); |
|
725 |
||
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 | 751 |
* Enqueue Javascript postMessage handlers for the Customizer. |
752 |
* |
|
753 |
* Binds JavaScript handlers to make the Customizer preview |
|
754 |
* reload changes asynchronously. |
|
755 |
* |
|
756 |
* @since Twenty Thirteen 1.0 |
|
757 |
*/ |
|
758 |
function twentythirteen_customize_preview_js() { |
|
5 | 759 |
wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true ); |
0 | 760 |
} |
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 | 781 |
|
782 |
if ( ! function_exists( 'wp_body_open' ) ) : |
|
783 |
/** |
|
784 |
* Fire the wp_body_open action. |
|
785 |
* |
|
786 |
* Added for backwards compatibility to support pre 5.2.0 WordPress versions. |
|
787 |
* |
|
788 |
* @since Twenty Thirteen 2.8 |
|
789 |
*/ |
|
790 |
function wp_body_open() { |
|
791 |
/** |
|
792 |
* Triggered after the opening <body> tag. |
|
793 |
* |
|
794 |
* @since Twenty Thirteen 2.8 |
|
795 |
*/ |
|
796 |
do_action( 'wp_body_open' ); |
|
797 |
} |
|
798 |
endif; |