Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
578 lines (530 loc) · 21.7 KB
/
Copy pathfunctions.php
File metadata and controls
578 lines (530 loc) · 21.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
<?php
/**
* Unapp functions and definitions.
*
* Unapp is a block theme: layout, colors, typography and spacing live in
* theme.json, templates in /templates and /parts, and section content in
* /patterns. This file only wires up the few things theme.json cannot express.
*
* @package Unapp
* @since 2.0.0
*/
defined( 'ABSPATH' ) || exit;
if ( ! defined( 'UNAPP_VERSION' ) ) {
// The parent's version, even when a child theme is active: wp_get_theme()
// alone returns the child, which would pin every asset URL to the child's
// version and report the wrong version to the update check.
define( 'UNAPP_VERSION', wp_get_theme( get_template() )->get( 'Version' ) );
}
/**
* Theme setup.
*
* Block themes get post-thumbnails, responsive-embeds, editor-styles, html5,
* automatic-feed-links, block-templates and wide alignment automatically, so
* only the extras are declared here.
*/
function unapp_setup() {
load_theme_textdomain( 'unapp', get_template_directory() . '/languages' );
// Load the small stylesheet inside the editor too, so cards/thumbnails match the front end.
add_editor_style( 'style.css' );
// WooCommerce renders through its own block templates in a block theme; declaring
// support keeps its product gallery features available and silences the
// "theme does not declare support" notice.
add_theme_support( 'woocommerce' );
// Post formats, so format-specific styling and patterns work on blogs.
add_theme_support(
'post-formats',
array( 'aside', 'audio', 'gallery', 'image', 'link', 'quote', 'status', 'video' )
);
}
add_action( 'after_setup_theme', 'unapp_setup' );
/**
* Enqueue the front-end stylesheet.
*
* Always the parent's style.css. get_stylesheet_uri() points at the child
* theme's file when one is active, which silently dropped the parent's rules
* (header, alignment, query cards, the price toggle) from every child theme.
* A child's own style.css is added after it, so its rules still win.
*/
function unapp_enqueue_styles() {
wp_enqueue_style( 'unapp-style', get_parent_theme_file_uri( 'style.css' ), array(), UNAPP_VERSION );
if ( is_child_theme() ) {
wp_enqueue_style(
'unapp-child-style',
get_stylesheet_uri(),
array( 'unapp-style' ),
wp_get_theme()->get( 'Version' )
);
}
}
add_action( 'wp_enqueue_scripts', 'unapp_enqueue_styles' );
/**
* WooCommerce compatibility styles, loaded only when WooCommerce is active.
*/
function unapp_woocommerce_styles() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
wp_enqueue_style(
'unapp-woocommerce',
get_theme_file_uri( 'assets/css/woocommerce.css' ),
array( 'unapp-style' ),
UNAPP_VERSION
);
}
add_action( 'wp_enqueue_scripts', 'unapp_woocommerce_styles', 20 );
/**
* Register block styles and their per-block stylesheets.
*
* Styles registered with wp_enqueue_block_style() are only loaded (and inlined,
* because a `path` is given) on pages that actually render that block.
*/
function unapp_block_styles() {
$styles = array(
'core/list' => array(
'stylesheet' => 'list-styles',
'variations' => array(
'checklist' => _x( 'Checklist', 'Block style label', 'unapp' ),
'dash' => _x( 'Dashed', 'Block style label', 'unapp' ),
'steps' => _x( 'Numbered steps', 'Block style label', 'unapp' ),
'two-col' => _x( 'Two columns', 'Block style label', 'unapp' ),
),
),
'core/image' => array(
'stylesheet' => 'image-styles',
'variations' => array(
'device' => _x( 'Device frame', 'Block style label', 'unapp' ),
'browser' => _x( 'Browser frame', 'Block style label', 'unapp' ),
'framed' => _x( 'Framed', 'Block style label', 'unapp' ),
),
),
'core/quote' => array(
'stylesheet' => 'quote-styles',
'variations' => array(
'testimonial' => _x( 'Testimonial card', 'Block style label', 'unapp' ),
),
),
'core/details' => array(
'stylesheet' => 'details-styles',
'variations' => array(
'faq-card' => _x( 'FAQ card', 'Block style label', 'unapp' ),
),
),
'core/table' => array(
'stylesheet' => 'table-styles',
'variations' => array(
'compare' => _x( 'Comparison', 'Block style label', 'unapp' ),
),
),
'core/separator' => array(
'stylesheet' => 'separator-styles',
'variations' => array(
'gradient' => _x( 'Gradient line', 'Block style label', 'unapp' ),
),
),
'core/button' => array(
'stylesheet' => 'button-styles',
'variations' => array(
'arrow' => _x( 'Text link with arrow', 'Block style label', 'unapp' ),
),
),
'core/columns' => array(
'stylesheet' => 'columns-styles',
'variations' => array(
'divided' => _x( 'Divided', 'Block style label', 'unapp' ),
),
),
);
foreach ( $styles as $block => $config ) {
foreach ( $config['variations'] as $name => $label ) {
register_block_style(
$block,
array(
'name' => $name,
'label' => $label,
)
);
}
$handle = 'unapp-' . $config['stylesheet'];
wp_enqueue_block_style(
$block,
array(
'handle' => $handle,
'src' => get_theme_file_uri( 'assets/css/' . $config['stylesheet'] . '.css' ),
'path' => get_theme_file_path( 'assets/css/' . $config['stylesheet'] . '.css' ),
'ver' => UNAPP_VERSION,
)
);
}
}
add_action( 'init', 'unapp_block_styles' );
/**
* Register pattern categories used by the theme's patterns.
*
* `unapp` holds every section so the whole library can be browsed in one place;
* the rest narrow it down by job.
*/
function unapp_pattern_categories() {
$categories = array(
'unapp' => array(
'label' => _x( 'Unapp', 'Block pattern category', 'unapp' ),
'description' => __( 'Every Unapp section: heroes, features, pricing, social proof, company and calls to action.', 'unapp' ),
),
'unapp_hero' => array(
'label' => _x( 'Unapp: Heroes', 'Block pattern category', 'unapp' ),
'description' => __( 'Opening sections for a landing page.', 'unapp' ),
),
'unapp_features' => array(
'label' => _x( 'Unapp: Features', 'Block pattern category', 'unapp' ),
'description' => __( 'Ways to explain what the product does.', 'unapp' ),
),
'unapp_proof' => array(
'label' => _x( 'Unapp: Social proof', 'Block pattern category', 'unapp' ),
'description' => __( 'Testimonials, logos, ratings and customer stories.', 'unapp' ),
),
'unapp_pricing' => array(
'label' => _x( 'Unapp: Pricing', 'Block pattern category', 'unapp' ),
'description' => __( 'Plan tables and comparisons.', 'unapp' ),
),
'unapp_cta' => array(
'label' => _x( 'Unapp: Calls to action', 'Block pattern category', 'unapp' ),
'description' => __( 'Conversion sections: sign-up bands, newsletters and app downloads.', 'unapp' ),
),
'unapp_content' => array(
'label' => _x( 'Unapp: Content & blog', 'Block pattern category', 'unapp' ),
'description' => __( 'Post loops, author boxes, changelogs and documentation.', 'unapp' ),
),
'unapp_company' => array(
'label' => _x( 'Unapp: Company', 'Block pattern category', 'unapp' ),
'description' => __( 'About, team, values, careers, offices and press.', 'unapp' ),
),
'unapp_utility' => array(
'label' => _x( 'Unapp: Utility', 'Block pattern category', 'unapp' ),
'description' => __( 'Contact, FAQ, legal and help-centre sections.', 'unapp' ),
),
'unapp_portfolio' => array(
'label' => _x( 'Unapp: Portfolio', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for designers, studios and freelancers: work grids, rates and process.', 'unapp' ),
),
'unapp_church' => array(
'label' => _x( 'Unapp: Church', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for a church site: service times, ministries, staff, giving and first-visit answers.', 'unapp' ),
),
'unapp_fitness' => array(
'label' => _x( 'Unapp: Fitness', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for gyms and studios: timetables, coaches, memberships and member stories.', 'unapp' ),
),
'unapp_finance' => array(
'label' => _x( 'Unapp: Finance', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for advisers and accountants: services, process, fees, credentials and risk warnings.', 'unapp' ),
),
'unapp_restaurant' => array(
'label' => _x( 'Unapp: Restaurant', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for restaurants and cafés: menus, opening hours, the kitchen and reviews.', 'unapp' ),
),
'unapp_agency' => array(
'label' => _x( 'Unapp: Agency', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for studios and agencies: capabilities, clients, engagements and enquiries.', 'unapp' ),
),
'unapp_shop' => array(
'label' => _x( 'Unapp: Shop', 'Block pattern category', 'unapp' ),
'description' => __( 'Storefront sections for WooCommerce: featured products, promises, the workshop and delivery answers.', 'unapp' ),
),
'unapp_realestate' => array(
'label' => _x( 'Unapp: Property', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for estate agents: listings, published fees and valuation enquiries.', 'unapp' ),
),
'unapp_medical' => array(
'label' => _x( 'Unapp: Practice', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for clinics and practices: treatments, clinicians, patient questions and opening hours.', 'unapp' ),
),
'unapp_education' => array(
'label' => _x( 'Unapp: Courses', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for course providers: timetables, tutors and booking answers.', 'unapp' ),
),
'unapp_events' => array(
'label' => _x( 'Unapp: Events', 'Block pattern category', 'unapp' ),
'description' => __( 'Sections for conferences and events: programmes, speakers, tickets and venue details.', 'unapp' ),
),
'unapp_home_services' => array(
'label' => _x( 'Unapp: Home Services', 'Block pattern category', 'unapp' ),
'description' => __( 'Repairs, maintenance, service areas and quote enquiries.', 'unapp' ),
),
'unapp_coach' => array(
'label' => _x( 'Unapp: Coach & Consultant', 'Block pattern category', 'unapp' ),
'description' => __( 'Coaching services, practical consulting and discovery-call enquiries.', 'unapp' ),
),
'unapp_photographer' => array(
'label' => _x( 'Unapp: Photographer', 'Block pattern category', 'unapp' ),
'description' => __( 'Image-led work, commissions, the approach and photography enquiries.', 'unapp' ),
),
'unapp_nonprofit' => array(
'label' => _x( 'Unapp: Nonprofit', 'Block pattern category', 'unapp' ),
'description' => __( 'Community programmes, volunteering, openness and ways to support.', 'unapp' ),
),
'unapp_cleaning' => array(
'label' => _x( 'Unapp: Cleaning', 'Block pattern category', 'unapp' ),
'description' => __( 'Home and workplace cleaning, checklists and quote requests.', 'unapp' ),
),
'unapp_salon' => array(
'label' => _x( 'Unapp: Salon & Barber', 'Block pattern category', 'unapp' ),
'description' => __( 'Hair services, visit information and appointment requests.', 'unapp' ),
),
'unapp_blog' => array(
'label' => _x( 'Unapp: Blog & magazine', 'Block pattern category', 'unapp' ),
'description' => __( 'Editorial furniture: mastheads, category tiles, author introductions and subscribe panels.', 'unapp' ),
),
'unapp_page' => array(
'label' => _x( 'Unapp: Full pages', 'Block pattern category', 'unapp' ),
'description' => __( 'Complete page layouts. Insert one into an empty page to start from a finished design.', 'unapp' ),
),
);
foreach ( $categories as $slug => $args ) {
register_block_pattern_category( $slug, $args );
}
}
add_action( 'init', 'unapp_pattern_categories' );
/**
* Hide patterns that depend on blocks the current WordPress does not have.
*
* Unapp supports WordPress 6.6 upwards, but some patterns are built on blocks
* that only arrived in 7.0 (Accordion, Breadcrumbs, Query Total, Time to Read).
* On older versions those patterns are unregistered rather than shown broken,
* and the templates fall back to the equivalents that have always existed.
*/
function unapp_unregister_unsupported_patterns() {
$requirements = array(
'unapp/faq-accordion' => 'core/accordion',
// Built from WooCommerce's product blocks; without WooCommerce it inserts
// an empty grid of missing-block placeholders.
'unapp/shop-featured' => 'woocommerce/product-collection',
'unapp/shop-featured-h1' => 'woocommerce/product-collection',
);
foreach ( $requirements as $pattern => $block ) {
if ( ! WP_Block_Type_Registry::get_instance()->is_registered( $block )
&& WP_Block_Patterns_Registry::get_instance()->is_registered( $pattern ) ) {
unregister_block_pattern( $pattern );
}
}
}
// Priority 20 runs after WooCommerce registers its blocks on init.
add_action( 'init', 'unapp_unregister_unsupported_patterns', 20 );
/**
* Keep the WooCommerce templates out of sight while WooCommerce is inactive.
*
* WordPress does not know "archive-product" or "page-cart" without WooCommerce,
* so it treated the theme's shop templates as custom page templates and offered
* them by raw slug in the page editor's Template menu.
*
* @param WP_Block_Template[] $templates Templates found.
* @return WP_Block_Template[]
*/
function unapp_hide_woocommerce_templates( $templates ) {
if ( class_exists( 'WooCommerce' ) ) {
return $templates;
}
$woo = array( 'archive-product', 'single-product', 'page-cart', 'page-checkout', 'order-confirmation', 'product-search-results' );
return array_values(
array_filter(
$templates,
static function ( $template ) use ( $woo ) {
return ! ( isset( $template->theme, $template->slug ) && get_stylesheet() === $template->theme && in_array( $template->slug, $woo, true ) );
}
)
);
}
add_filter( 'get_block_templates', 'unapp_hide_woocommerce_templates' );
/**
* Give the comment form's "Leave a Reply" heading the right level.
*
* Core prints it as an h3 straight after the post's h1, which skips a level.
*
* @param array $defaults Comment form arguments.
* @return array
*/
function unapp_comment_form_heading( $defaults ) {
$defaults['title_reply_before'] = '<h2 id="reply-title" class="comment-reply-title">';
$defaults['title_reply_after'] = '</h2>';
return $defaults;
}
add_filter( 'comment_form_defaults', 'unapp_comment_form_heading' );
/**
* Strip blocks that need a newer WordPress out of templates and patterns.
*
* `render_block` returns an empty string for an unregistered block, so the only
* thing needed is to make sure nothing else breaks around it. Breadcrumbs,
* Query Total and Time to Read all degrade to nothing, which is the intended
* behaviour on 6.6–6.9.
*
* @param string $block_content Rendered block HTML.
* @param array $block Parsed block.
* @return string Block HTML, or an empty string when the block is unavailable.
*/
function unapp_skip_unsupported_blocks( $block_content, $block ) {
$optional = array( 'core/breadcrumbs', 'core/query-total', 'core/post-time-to-read', 'core/accordion' );
if ( in_array( $block['blockName'] ?? '', $optional, true )
&& ! WP_Block_Type_Registry::get_instance()->is_registered( $block['blockName'] ) ) {
return '';
}
return $block_content;
}
add_filter( 'render_block', 'unapp_skip_unsupported_blocks', 10, 2 );
/**
* Give the theme's own images width and height attributes when they render.
*
* core/image's save() never writes them, so a pattern cannot carry them (the
* block would fail validation). WordPress only adds loading="lazy" and
* fetchpriority="high" to images that have both, so without them every theme
* image loaded eagerly and the hero never got priority. The generator already
* reserves each box with an aspect ratio; this supplies the attributes from the
* file itself, for images served from this theme's assets/images only.
*
* @param string $block_content Rendered block HTML.
* @return string
*/
function unapp_theme_image_size( $block_content ) {
if ( false === strpos( $block_content, '/assets/images/' ) ) {
return $block_content;
}
static $sizes = array();
$base = trailingslashit( get_template_directory_uri() );
$tags = new WP_HTML_Tag_Processor( $block_content );
while ( $tags->next_tag( 'img' ) ) {
$src = (string) $tags->get_attribute( 'src' );
if ( null !== $tags->get_attribute( 'width' ) || 0 !== strpos( $src, $base . 'assets/images/' ) ) {
continue;
}
$relative = substr( strtok( $src, '?' ), strlen( $base ) );
if ( ! array_key_exists( $relative, $sizes ) ) {
$file = get_parent_theme_file_path( $relative );
$sizes[ $relative ] = null;
if ( '.svg' === substr( $file, -4 ) && is_readable( $file ) ) {
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- local theme file, first 2 KB.
$head = (string) file_get_contents( $file, false, null, 0, 2048 );
if ( preg_match( '/viewBox="\s*[-\d.]+\s+[-\d.]+\s+([\d.]+)\s+([\d.]+)/', $head, $m ) ) {
$sizes[ $relative ] = array( (float) $m[1], (float) $m[2] );
}
} elseif ( is_readable( $file ) ) {
$info = wp_getimagesize( $file );
if ( $info ) {
$sizes[ $relative ] = array( (float) $info[0], (float) $info[1] );
}
}
}
$size = $sizes[ $relative ];
if ( ! $size || ! $size[1] ) {
continue;
}
// Logo rows set only a height; scale the width attribute to match it, or
// the browser would stretch the logo to the file's full width.
$style = (string) $tags->get_attribute( 'style' );
if ( preg_match( '/(?:^|;)\s*height:\s*(\d+)px/', $style, $h ) && false === strpos( $style, 'width:' ) ) {
$size = array( $size[0] * $h[1] / $size[1], (float) $h[1] );
}
$tags->set_attribute( 'width', (string) round( $size[0] ) );
$tags->set_attribute( 'height', (string) round( $size[1] ) );
}
return $tags->get_updated_html();
}
add_filter( 'render_block_core/image', 'unapp_theme_image_size' );
add_filter( 'render_block_core/cover', 'unapp_theme_image_size' );
/**
* Lazily enqueue the stat counter script.
*
* The Stats pattern marks its numbers with the `unapp-count` class. The script
* is only loaded on requests that actually render such a paragraph, so plain
* blog pages ship zero JavaScript from the theme.
*
* @param string $block_content Rendered block HTML.
* @param array $block Parsed block.
* @return string Unchanged block HTML.
*/
function unapp_maybe_enqueue_counter( $block_content, $block ) {
if ( isset( $block['attrs']['className'] ) && false !== strpos( $block['attrs']['className'], 'unapp-count' ) ) {
wp_enqueue_script(
'unapp-counter',
get_theme_file_uri( 'assets/js/counter.js' ),
array(),
UNAPP_VERSION,
array(
'in_footer' => true,
'strategy' => 'defer',
)
);
}
return $block_content;
}
add_filter( 'render_block_core/paragraph', 'unapp_maybe_enqueue_counter', 10, 2 );
/**
* Front page setup (Home + Blog pages, Settings → Reading) on activation.
*/
require get_parent_theme_file_path( 'inc/front-page-setup.php' );
/**
* Starter sites: complete designs for different kinds of website.
*/
require get_parent_theme_file_path( 'inc/content.php' );
require get_parent_theme_file_path( 'inc/starter-sites.php' );
require get_parent_theme_file_path( 'inc/starter-finder.php' );
require get_parent_theme_file_path( 'inc/starter-import.php' );
require get_parent_theme_file_path( 'inc/starter-history.php' );
require get_parent_theme_file_path( 'inc/starter-preview.php' );
/**
* Contact forms: render whichever form plugin is active, styled to the palette.
*/
require get_parent_theme_file_path( 'inc/forms.php' );
require get_parent_theme_file_path( 'inc/form-selection.php' );
require get_parent_theme_file_path( 'inc/launch-checklist.php' );
require get_parent_theme_file_path( 'inc/launch-recommendations.php' );
require get_parent_theme_file_path( 'inc/design.php' );
require get_parent_theme_file_path( 'inc/service-cards.php' );
require get_parent_theme_file_path( 'inc/business-profile.php' );
require get_parent_theme_file_path( 'inc/finish.php' );
require get_parent_theme_file_path( 'inc/content-guide.php' );
require get_parent_theme_file_path( 'inc/section-swaps.php' );
require get_parent_theme_file_path( 'inc/personalized-preview.php' );
/**
* Visitor colour-scheme toggle, active only where the toggle pattern is used.
*/
require get_parent_theme_file_path( 'inc/scheme.php' );
/**
* Setup wizard: name, logo, palette, typeface and the plugins a starter needs.
*/
require get_parent_theme_file_path( 'inc/setup-wizard.php' );
/**
* Updates for a theme distributed outside WordPress.org.
*/
require get_parent_theme_file_path( 'inc/updates.php' );
/**
* Load the monthly/yearly price switch only on pages that render one.
*
* @param string $content Rendered block content.
* @param array $block Parsed block.
* @return string
*/
function unapp_period_toggle_script( $content, $block ) {
if ( isset( $block['attrs']['className'] ) && false !== strpos( $block['attrs']['className'], 'unapp-period' ) ) {
wp_enqueue_script(
'unapp-period-toggle',
get_theme_file_uri( 'assets/js/period-toggle.js' ),
array(),
UNAPP_VERSION,
true
);
wp_localize_script( 'unapp-period-toggle', 'unappPeriodToggle', array( 'label' => __( 'Yearly billing', 'unapp' ) ) );
}
return $content;
}
add_filter( 'render_block_core/button', 'unapp_period_toggle_script', 10, 2 );
/**
* Editor and markup support this theme predates.
*/
if ( ! function_exists( 'unapp_modern_supports' ) ) {
function unapp_modern_supports() {
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ) );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'align-wide' );
add_theme_support( 'editor-styles' );
add_theme_support( 'automatic-feed-links' );
}
add_action( 'after_setup_theme', 'unapp_modern_supports', 20 );
}