質問編集履歴

1

jstork/functions\.phpのPHPに変更しました。

2017/02/23 14:05

投稿

kotaro315
kotaro315

スコア12

test CHANGED
File without changes
test CHANGED
@@ -24,123 +24,505 @@
24
24
 
25
25
  <?php
26
26
 
27
-
28
-
29
- /*********************
30
-
31
- include function file
32
-
33
- *********************/
34
-
35
- require_once( 'library/customizer.php' );
36
-
37
- require_once( 'library/shortcode.php' );
38
-
39
- require_once( 'library/widget.php' );
40
-
41
- require_once( 'library/custom-post-type.php' );
42
-
43
- require_once( 'library/admin.php' );
44
-
45
-
46
-
47
-
48
-
49
- /*********************
50
-
51
- title tags
52
-
53
- *********************/
54
-
55
- if (!function_exists('rw_title')) {
56
-
57
- function rw_title( $title, $sep, $seplocation ) {
58
-
59
- global $page, $paged;
60
-
61
-
62
-
63
- if ( is_feed() ) return $title;
64
-
65
-
66
-
67
- $sep = " | ";
68
-
69
- if ( 'right' == $seplocation ) {
70
-
71
- $title .= get_bloginfo( 'name' );
72
-
73
- } elseif ( is_home() || is_front_page() ){
74
-
75
- $title = $title . get_bloginfo( 'name' );
76
-
77
- } else {
78
-
79
- $title = $title . "{$sep}" . get_bloginfo( 'name' );
80
-
81
- }
82
-
83
- $site_description = get_bloginfo( 'description', 'display' );
84
-
85
- if ( $site_description && ( is_home() || is_front_page() ) ) {
86
-
87
- $title .= "{$sep}{$site_description}";
88
-
89
- }
90
-
91
- if ( $paged >= 2 || $page >= 2 ) {
92
-
93
- $title .= " {$sep} " . sprintf( __( '%sページ目', 'dbt' ), max( $paged, $page ) );
94
-
95
- }
96
-
97
- return $title;
27
+ /**
28
+
29
+ * Twenty Fifteen functions and definitions
30
+
31
+ *
32
+
33
+ * Set up the theme and provides some helper functions, which are used in the
34
+
35
+ * theme as custom template tags. Others are attached to action and filter
36
+
37
+ * hooks in WordPress to change core functionality.
38
+
39
+ *
40
+
41
+ * When using a child theme you can override certain functions (those wrapped
42
+
43
+ * in a function_exists() call) by defining them first in your child theme's
44
+
45
+ * functions.php file. The child theme's functions.php file is included before
46
+
47
+ * the parent theme's file, so the child theme functions would be used.
48
+
49
+ *
50
+
51
+ * @link https://codex.wordpress.org/Theme_Development
52
+
53
+ * @link https://codex.wordpress.org/Child_Themes
54
+
55
+ *
56
+
57
+ * Functions that are not pluggable (not wrapped in function_exists()) are
58
+
59
+ * instead attached to a filter or action hook.
60
+
61
+ *
62
+
63
+ * For more information on hooks, actions, and filters,
64
+
65
+ * {@link https://codex.wordpress.org/Plugin_API}
66
+
67
+ *
68
+
69
+ * @package WordPress
70
+
71
+ * @subpackage Twenty_Fifteen
72
+
73
+ * @since Twenty Fifteen 1.0
74
+
75
+ */
76
+
77
+
78
+
79
+ /**
80
+
81
+ * Set the content width based on the theme's design and stylesheet.
82
+
83
+ *
84
+
85
+ * @since Twenty Fifteen 1.0
86
+
87
+ */
88
+
89
+ if ( ! isset( $content_width ) ) {
90
+
91
+ $content_width = 660;
92
+
93
+ }
94
+
95
+
96
+
97
+ /**
98
+
99
+ * Twenty Fifteen only works in WordPress 4.1 or later.
100
+
101
+ */
102
+
103
+ if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) {
104
+
105
+ require get_template_directory() . '/inc/back-compat.php';
106
+
107
+ }
108
+
109
+
110
+
111
+ if ( ! function_exists( 'twentyfifteen_setup' ) ) :
112
+
113
+ /**
114
+
115
+ * Sets up theme defaults and registers support for various WordPress features.
116
+
117
+ *
118
+
119
+ * Note that this function is hooked into the after_setup_theme hook, which
120
+
121
+ * runs before the init hook. The init hook is too late for some features, such
122
+
123
+ * as indicating support for post thumbnails.
124
+
125
+ *
126
+
127
+ * @since Twenty Fifteen 1.0
128
+
129
+ */
130
+
131
+ function twentyfifteen_setup() {
132
+
133
+
134
+
135
+ /*
136
+
137
+ * Make theme available for translation.
138
+
139
+ * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfifteen
140
+
141
+ * If you're building a theme based on twentyfifteen, use a find and replace
142
+
143
+ * to change 'twentyfifteen' to the name of your theme in all the template files
144
+
145
+ */
146
+
147
+ load_theme_textdomain( 'twentyfifteen' );
148
+
149
+
150
+
151
+ // Add default posts and comments RSS feed links to head.
152
+
153
+ add_theme_support( 'automatic-feed-links' );
154
+
155
+
156
+
157
+ /*
158
+
159
+ * Let WordPress manage the document title.
160
+
161
+ * By adding theme support, we declare that this theme does not use a
162
+
163
+ * hard-coded <title> tag in the document head, and expect WordPress to
164
+
165
+ * provide it for us.
166
+
167
+ */
168
+
169
+ add_theme_support( 'title-tag' );
170
+
171
+
172
+
173
+ /*
174
+
175
+ * Enable support for Post Thumbnails on posts and pages.
176
+
177
+ *
178
+
179
+ * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
180
+
181
+ */
182
+
183
+ add_theme_support( 'post-thumbnails' );
184
+
185
+ set_post_thumbnail_size( 825, 510, true );
186
+
187
+
188
+
189
+ // This theme uses wp_nav_menu() in two locations.
190
+
191
+ register_nav_menus( array(
192
+
193
+ 'primary' => __( 'Primary Menu', 'twentyfifteen' ),
194
+
195
+ 'social' => __( 'Social Links Menu', 'twentyfifteen' ),
196
+
197
+ ) );
198
+
199
+
200
+
201
+ /*
202
+
203
+ * Switch default core markup for search form, comment form, and comments
204
+
205
+ * to output valid HTML5.
206
+
207
+ */
208
+
209
+ add_theme_support( 'html5', array(
210
+
211
+ 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
212
+
213
+ ) );
214
+
215
+
216
+
217
+ /*
218
+
219
+ * Enable support for Post Formats.
220
+
221
+ *
222
+
223
+ * See: https://codex.wordpress.org/Post_Formats
224
+
225
+ */
226
+
227
+ add_theme_support( 'post-formats', array(
228
+
229
+ 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
230
+
231
+ ) );
232
+
233
+
234
+
235
+ /*
236
+
237
+ * Enable support for custom logo.
238
+
239
+ *
240
+
241
+ * @since Twenty Fifteen 1.5
242
+
243
+ */
244
+
245
+ add_theme_support( 'custom-logo', array(
246
+
247
+ 'height' => 248,
248
+
249
+ 'width' => 248,
250
+
251
+ 'flex-height' => true,
252
+
253
+ ) );
254
+
255
+
256
+
257
+ $color_scheme = twentyfifteen_get_color_scheme();
258
+
259
+ $default_color = trim( $color_scheme[0], '#' );
260
+
261
+
262
+
263
+ // Setup the WordPress core custom background feature.
264
+
265
+
266
+
267
+ /**
268
+
269
+ * Filter Twenty Fifteen custom-header support arguments.
270
+
271
+ *
272
+
273
+ * @since Twenty Fifteen 1.0
274
+
275
+ *
276
+
277
+ * @param array $args {
278
+
279
+ * An array of custom-header support arguments.
280
+
281
+ *
282
+
283
+ * @type string $default-color Default color of the header.
284
+
285
+ * @type string $default-attachment Default attachment of the header.
286
+
287
+ * }
288
+
289
+ */
290
+
291
+ add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array(
292
+
293
+ 'default-color' => $default_color,
294
+
295
+ 'default-attachment' => 'fixed',
296
+
297
+ ) ) );
298
+
299
+
300
+
301
+ /*
302
+
303
+ * This theme styles the visual editor to resemble the theme style,
304
+
305
+ * specifically font, colors, icons, and column width.
306
+
307
+ */
308
+
309
+ add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) );
310
+
311
+
312
+
313
+ // Indicate widget sidebars can use selective refresh in the Customizer.
314
+
315
+ add_theme_support( 'customize-selective-refresh-widgets' );
316
+
317
+ }
318
+
319
+ endif; // twentyfifteen_setup
320
+
321
+ add_action( 'after_setup_theme', 'twentyfifteen_setup' );
322
+
323
+
324
+
325
+ /**
326
+
327
+ * Register widget area.
328
+
329
+ *
330
+
331
+ * @since Twenty Fifteen 1.0
332
+
333
+ *
334
+
335
+ * @link https://codex.wordpress.org/Function_Reference/register_sidebar
336
+
337
+ */
338
+
339
+ function twentyfifteen_widgets_init() {
340
+
341
+ register_sidebar( array(
342
+
343
+ 'name' => __( 'Widget Area', 'twentyfifteen' ),
344
+
345
+ 'id' => 'sidebar-1',
346
+
347
+ 'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ),
348
+
349
+ 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
350
+
351
+ 'after_widget' => '</aside>',
352
+
353
+ 'before_title' => '<h2 class="widget-title">',
354
+
355
+ 'after_title' => '</h2>',
356
+
357
+ ) );
358
+
359
+ }
360
+
361
+ add_action( 'widgets_init', 'twentyfifteen_widgets_init' );
362
+
363
+
364
+
365
+ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) :
366
+
367
+ /**
368
+
369
+ * Register Google fonts for Twenty Fifteen.
370
+
371
+ *
372
+
373
+ * @since Twenty Fifteen 1.0
374
+
375
+ *
376
+
377
+ * @return string Google fonts URL for the theme.
378
+
379
+ */
380
+
381
+ function twentyfifteen_fonts_url() {
382
+
383
+ $fonts_url = '';
384
+
385
+ $fonts = array();
386
+
387
+ $subsets = 'latin,latin-ext';
388
+
389
+
390
+
391
+ /*
392
+
393
+ * Translators: If there are characters in your language that are not supported
394
+
395
+ * by Noto Sans, translate this to 'off'. Do not translate into your own language.
396
+
397
+ */
398
+
399
+ if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) {
400
+
401
+ $fonts[] = 'Noto Sans:400italic,700italic,400,700';
98
402
 
99
403
  }
100
404
 
405
+
406
+
407
+ /*
408
+
409
+ * Translators: If there are characters in your language that are not supported
410
+
411
+ * by Noto Serif, translate this to 'off'. Do not translate into your own language.
412
+
413
+ */
414
+
415
+ if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) {
416
+
417
+ $fonts[] = 'Noto Serif:400italic,700italic,400,700';
418
+
419
+ }
420
+
421
+
422
+
423
+ /*
424
+
425
+ * Translators: If there are characters in your language that are not supported
426
+
427
+ * by Inconsolata, translate this to 'off'. Do not translate into your own language.
428
+
429
+ */
430
+
431
+ if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) {
432
+
433
+ $fonts[] = 'Inconsolata:400,700';
434
+
435
+ }
436
+
437
+
438
+
439
+ /*
440
+
441
+ * Translators: To add an additional character subset specific to your language,
442
+
443
+ * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language.
444
+
445
+ */
446
+
447
+ $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );
448
+
449
+
450
+
451
+ if ( 'cyrillic' == $subset ) {
452
+
453
+ $subsets .= ',cyrillic,cyrillic-ext';
454
+
455
+ } elseif ( 'greek' == $subset ) {
456
+
457
+ $subsets .= ',greek,greek-ext';
458
+
459
+ } elseif ( 'devanagari' == $subset ) {
460
+
461
+ $subsets .= ',devanagari';
462
+
463
+ } elseif ( 'vietnamese' == $subset ) {
464
+
465
+ $subsets .= ',vietnamese';
466
+
467
+ }
468
+
469
+
470
+
471
+ if ( $fonts ) {
472
+
473
+ $fonts_url = add_query_arg( array(
474
+
475
+ 'family' => urlencode( implode( '|', $fonts ) ),
476
+
477
+ 'subset' => urlencode( $subsets ),
478
+
479
+ ), 'https://fonts.googleapis.com/css' );
480
+
481
+ }
482
+
483
+
484
+
485
+ return $fonts_url;
486
+
101
487
  }
102
488
 
103
-
489
+ endif;
490
+
491
+
492
+
104
-
493
+ /**
494
+
495
+ * JavaScript Detection.
496
+
497
+ *
498
+
105
- function opencage_rss_version() { return ''; }
499
+ * Adds a `js` class to the root `<html>` element when JavaScript is detected.
500
+
106
-
501
+ *
502
+
107
-
503
+ * @since Twenty Fifteen 1.1
504
+
108
-
505
+ */
506
+
109
- function opencage_remove_wp_ver_css_js( $src ) {
507
+ function twentyfifteen_javascript_detection() {
110
-
111
- if ( strpos( $src, 'ver=' ) )
508
+
112
-
113
- $src = remove_query_arg( 'ver', $src );
509
+ echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
114
-
115
- return $src;
116
510
 
117
511
  }
118
512
 
119
-
120
-
121
- function opencage_remove_wp_widget_recent_comments_style() {
122
-
123
- if ( has_filter( 'wp_head', 'wp_widget_recent_comments_style' ) ) {
124
-
125
- remove_filter( 'wp_head', 'wp_widget_recent_comments_style' );
513
+ add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 );
126
-
514
+
515
+
516
+
127
- }
517
+ /**
128
-
129
- }
518
+
130
-
131
-
132
-
133
- function opencage_remove_recent_comments_style() {
519
+ * Enqueue scripts and styles.
520
+
134
-
521
+ *
522
+
135
- global $wp_widget_factory;
523
+ * @since Twenty Fifteen 1.0
136
-
524
+
137
- if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
525
+ */
138
-
139
- remove_action( 'wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style') );
140
-
141
- }
142
-
143
- }
144
526
 
145
527
 
146
528