/
functions.php
590 lines (525 loc) · 22.2 KB
/
functions.php
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
579
580
581
582
583
584
585
586
587
588
589
590
<?php
/** Theme version */
const TAINACAN_INTERFACE_VERSION = '2.4.4';
/**
* Setup Theme
*/
if ( ! function_exists( 'tainacan_setup' ) ) {
/**
* Executa após o tema ser inicializado.
* Isso é usado para a configuração básica do tema, registro dos recursos do tema e init hooks.
* Observe que esta função está conectada ao gancho (`hook`) `after_setup_theme`, que é executado antes do gancho de init.
*/
function tainacan_setup() {
load_theme_textdomain( 'tainacan-interface', get_template_directory() . '/languages' );
/**
* Display in gutenberg plugin the full width for image
*/
add_theme_support( 'html5', array( 'navigation-widgets', 'comment-list', 'comment-form' ) );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'responsive-embeds' );
/**
* Removes support for Gutenberg widgets editor, by now...
*/
remove_theme_support( 'widgets-block-editor' );
/**
* Custom header to change the banner image
*/
$header_args = array(
'width' => 2000,
'height' => 625,
'header-text' => false,
'flex-width' => true,
'flex-height' => true,
);
add_theme_support( 'custom-header', $header_args );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
require_once get_template_directory() . '/functions/enqueues.php' ;
/**
* Custom logo to change the logo image
*/
$logo_args = array(
'height' => 30,
'width' => 175,
'flex-height' => true,
'flex-width' => true,
);
add_theme_support( 'custom-logo', $logo_args );
if ( function_exists( 'tainacan_register_view_mode' ) ) {
tainacan_register_view_mode('grid', array(
'label' => __( 'Thumbnail', 'tainacan-interface' ),
'description' => __( 'A thumbnail grid view, showing only title and thumbnail', 'tainacan-interface' ),
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewminiature tainacan-icon-1-25em"></i></span>',
'dynamic_metadata' => false,
'template' => get_template_directory() . '/tainacan/view-mode-grid.php',
'skeleton_template' => '<div class="tainacan-grid-container">
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
<div class="skeleton tainacan-grid-item"></div>
</div>'
));
}
/**
* Gutenberg support
*/
$default_color = '#298596';
if (function_exists('tainacan_get_color_scheme')) {
$color_scheme = tainacan_get_color_scheme();
if ($color_scheme && $color_scheme[2]) {
$default_color = $color_scheme[2];
}
}
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Default', 'tainacan-interface' ),
'slug' => 'default',
'color' => $default_color
),
array(
'name' => __( 'Carmine', 'tainacan-interface' ),
'slug' => 'carmine',
'color' => '#8c442c',
),
array(
'name' => __( 'Cherry', 'tainacan-interface' ),
'slug' => 'cherry',
'color' => '#A12B42',
),
array(
'name' => __( 'Mustard', 'tainacan-interface' ),
'slug' => 'mustard',
'color' => '#754E24',
),
array(
'name' => __( 'Mint Green', 'tainacan-interface' ),
'slug' => 'mintgreen',
'color' => '#255F56',
),
array(
'name' => __( 'Dark Turquoise', 'tainacan-interface' ),
'slug' => 'darkturquoise',
'color' => '#205E6F',
),
array(
'name' => __( 'Turquoise', 'tainacan-interface' ),
'slug' => 'turquoise',
'color' => '#185F6D',
),
array(
'name' => __( 'Blue Heavenly', 'tainacan-interface' ),
'slug' => 'blueheavenly',
'color' => '#1D5C86',
),
array(
'name' => __( 'Purple', 'tainacan-interface' ),
'slug' => 'purple',
'color' => '#4751a3',
),
array(
'name' => __( 'Violet', 'tainacan-interface' ),
'slug' => 'violet',
'color' => '#955ba5',
),
array(
'name' => __( 'White', 'tainacan-interface' ),
'slug' => 'white',
'color' => '#ffffff',
),
array(
'name' => __( 'Light gray', 'tainacan-interface' ),
'slug' => 'lightgray',
'color' => '#f2f2f2',
),
array(
'name' => __( 'Dark gray', 'tainacan-interface' ),
'slug' => 'darkgray',
'color' => '#555758',
),
) );
add_theme_support( 'align-wide' );
add_theme_support( 'custom-line-height' );
add_theme_support( 'custom-units' );
add_theme_support( 'editor-font-sizes', array(
array(
'name' => esc_attr__( 'Small', 'tainacan-interface' ),
'size' => 14,
'slug' => 'small'
),
array(
'name' => esc_attr__( 'Regular', 'tainacan-interface' ),
'size' => 16,
'slug' => 'regular'
),
array(
'name' => esc_attr__( 'Large', 'tainacan-interface' ),
'size' => 18,
'slug' => 'large'
),
array(
'name' => esc_attr__( 'Huge', 'tainacan-interface' ),
'size' => 24,
'slug' => 'huge'
)
) );
add_theme_support( 'editor-style' );
add_editor_style( 'editor-style.css' );
}
} // tainacan_setup check
add_action( 'after_setup_theme', 'tainacan_setup' );
/**
* Passes the custom color to a css variable used on the theme-side editor style
*
*/
function tainacan_customize_editor_css() {
$default_color = '#298596';
if (function_exists('tainacan_get_color_scheme')) {
$color_scheme = tainacan_get_color_scheme();
if ($color_scheme && $color_scheme[2]) {
$default_color = $color_scheme[2];
}
}
?>
<style>
.editor-styles-wrapper {
--tainacan-color-default: <?php echo $default_color == 'default' ? 'var(--tainacan-interface--link-color, #298596)' : $default_color; ?>;
--tainacan-block-primary: <?php echo $default_color == 'default' ? 'var(--tainacan-interface--link-color, #298596)' : $default_color;?>;
}
</style>
<?php
}
add_action( 'admin_head', 'tainacan_customize_editor_css');
/**
* This function modifies the main WordPress query to include an array of
* post types instead of the default 'post' post type.
*
* @param object $query The main WordPress query.
*/
function tainacan_include_items_in_search_results( $query ) {
if ( !is_post_type_archive() && isset($_GET['s']) ) {
if ( defined ('TAINACAN_VERSION') &&
$query->get( 'post_type' ) !== 'tainacan-collection' &&
(!isset($_GET['onlyposts']) || !$_GET['onlyposts']) &&
(!isset($_GET['onlypages']) || !$_GET['onlypages']) &&
$query->is_main_query() &&
$query->is_search() &&
!is_admin()
) {
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
$existing_post_types = $query->get( 'post_type' );
if ( !is_array($existing_post_types) )
$existing_post_types = [ $existing_post_types ];
$query->set( 'post_type', array_merge( $existing_post_types, ['post', 'page', 'tainacan-collection'], $collections_post_types ) );
} else if ( isset($_GET['onlypages']) && $_GET['onlypages'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
$query->set( 'post_type', 'pages' );
} else if ( isset($_GET['onlyposts']) && $_GET['onlyposts'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
$query->set( 'post_type', 'post' );
}
}
}
add_action( 'pre_get_posts', 'tainacan_include_items_in_search_results' );
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since Tainacan Theme
*/
if ( ! isset( $content_width ) ) {
$content_width = 1400;
}
/**
* Alert user if Tainacan plugin is not installed.
*
* @since Tainacan Theme
*/
function tainacan_interface_admin_notice() {
global $pagenow;
if ( !defined('TAINACAN_VERSION') && $pagenow == 'themes.php' ) {
echo '<div class="notice notice-warning is-dismissible">
<p>' . __('Warning: <a href="https://wordpress.org/plugins/tainacan/" >Tainacan plugin</a> is not activated! While you may use this theme without it, we made it to take full advantage of the plugin features.', 'tainacan-interface') . '</p>
</div>';
}
}
add_action('admin_notices', 'tainacan_interface_admin_notice');
/**
* Adds extra classes dp body tag. has-not-finished-loading is removed
* from tag after jQuery.document(ready). It is used to style page while
* not all DOM and JS is finished.
*
* @since Tainacan Theme
*/
add_filter( 'body_class', 'custom_class' );
function custom_class( $classes ) {
$classes[] = 'loading-content';
return $classes;
}
/*
* Register Widgets SideBar
*/
function tainacan_widgets_sidebar_init() {
register_sidebar( array(
'name' => __( 'Tainacan Sidebar Right', 'tainacan-interface' ),
'id' => 'tainacan-sidebar-right',
'before_widget' => '<aside id="%1$s" class="pb-4 pl-4 widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title font-weight-bold">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'tainacan_widgets_sidebar_init' );
/*
* Register Widgets footer
*/
function tainacan_widgets_footer_init() {
register_sidebar( array(
'name' => __( 'Tainacan Sidebar Footer', 'tainacan-interface' ),
'id' => 'tainacan-sidebar-footer',
'before_widget' => '<li class="mb-lg-4 border-left-0 border-right-0 border-bottom-0 tainacan-side"><input type="checkbox" checked><i></i>',
'after_widget' => '</li>',
'before_title' => '<h6 class="text-white font-weight-bold mb-lg-4">',
'after_title' => ' <i class="tainacan-icon mt-0"></i></h6>',
) );
}
add_action( 'widgets_init', 'tainacan_widgets_footer_init' );
/*
* Register Tainacan Heading Section Pattern
*/
function tainacan_block_patterns_init() {
global $wp_version;
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ((is_plugin_active('gutenberg/gutenberg.php') || $wp_version >= '5') && function_exists('register_block_pattern_category')) {
register_block_pattern_category(
'tainacan-interface',
array( 'label' => _x( 'Tainacan Interface', 'Block pattern category', 'tainacan-interface' ) ) );
}
if ((is_plugin_active('gutenberg/gutenberg.php') || $wp_version >= '5') && function_exists('register_block_pattern')) {
register_block_pattern(
'tainacan-interface/tainacan-heading-section-pattern',
array(
'title' => __( 'Tainacan heading section', 'tainacan-interface' ),
'description' => _x( 'A left-aligned heading section containing a light sub-heading and an underline below the title.', 'Block pattern description', 'tainacan-interface' ),
'content' => '<!-- wp:group {"className":"tainacan-heading-section-pattern-pattern"} --><div class="wp-block-group tainacan-heading-section-pattern-pattern"><div class="wp-block-group__inner-container"><!-- wp:heading {"textColor":"default","style":{"typography":{"fontSize":24}}} --><h2 class="has-default-color has-text-color" style="font-size:24px">' . esc_html__( 'Section title', 'tainacan-interface' ) . '</h2><!-- /wp:heading --><!-- wp:paragraph {"style":{"color":{"text":"#838386"}}} --><p class="has-text-color" style="color:#898d8f">' . esc_html__( 'Section optional description...', 'tainacan-interface' ) . '</p><!-- /wp:paragraph --><!-- wp:separator {"color":"default"} --><hr class="wp-block-separator has-text-color has-background has-default-background-color has-default-color"/><!-- /wp:separator --><!-- wp:spacer {"height":32} --><div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --></div></div><!-- /wp:group -->',
'categories' => array('tainacan-interface')
)
);
register_block_pattern(
'tainacan-interface/tainacan-highlight-section-pattern',
array(
'title' => __( 'Tainacan highlight section', 'tainacan-interface' ),
'description' => _x( 'A hero section with a background color and columns for image and text.', 'Block pattern description', 'tainacan-interface' ),
'content' => '
<!-- wp:cover {"overlayColor":"default","align":"full"} -->
<div class="wp-block-cover alignfull has-default-background-color has-background-dim">
<div class="wp-block-cover__inner-container">
<!-- wp:spacer {"height": 24} -->
<div style="height:24px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:heading {"style":{"color":{"text":"#ffffff"}}} -->
<h2 class="has-text-color" style="color:#ffffff">' . esc_html__( 'Section title', 'tainacan-interface' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:spacer {"height": 16} -->
<div style="height:16px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:columns {"style":{"color":{"text":"#ffffff"}}} -->
<div class="wp-block-columns has-text-color" style="color:#ffffff">
<!-- wp:column {"width":33.33} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- wp:image {"id":152274,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/thumbnail_placeholder.png' . '" alt="" class="wp-image-152274"/></figure>
<!-- /wp:image -->
</div>
<!-- /wp:column -->
<!-- wp:column {"width":66.66} -->
<div class="wp-block-column" style="flex-basis:66.66%">
<!-- wp:paragraph {"fontSize":"normal"} -->
<p class="has-normal-font-size">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"right","style":{"color":{"text":"#ffffff"}}} -->
<p class="has-text-align-right has-text-color" style="color:#ffffff"><a href="/"> ' .esc_html__( 'View more...', 'tainacan-interface' ) . '</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
<!-- wp:spacer {"height": 32} -->
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
</div>
</div>
<!-- /wp:cover -->',
'categories' => array('tainacan-interface')
)
);
register_block_pattern(
'tainacan-interface/tainacan-highlight-section-pattern-alt',
array(
'title' => __( 'Tainacan highlight section (alt)', 'tainacan-interface' ),
'description' => _x( 'Another hero section with a background color and columns for image headings and text.', 'Block pattern description', 'tainacan-interface' ),
'content' => '
<!-- wp:cover {"customOverlayColor":"#01295c","align":"full"} -->
<div class="wp-block-cover alignfull has-background-dim" style="background-color:#01295c">
<div class="wp-block-cover__inner-container">
<!-- wp:spacer {"height": 16} -->
<div style="height:16px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:columns {"style":{"color":{"text":"#ffffff"}}} -->
<div class="wp-block-columns has-text-color" style="color:#ffffff">
<!-- wp:column {"width":33.33} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- wp:image {"id":152274,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/thumbnail_placeholder.png' . '" alt="" class="wp-image-152274"/></figure>
<!-- /wp:image -->
</div>
<!-- /wp:column -->
<!-- wp:column {"width":33.33} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- wp:heading {"style":{"color":{"text":"#ffffff"}}} -->
<h2 class="has-text-color" style="color:#ffffff">' . esc_html__( 'Section title', 'tainacan-interface' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"fontSize":"normal"} -->
<p class="has-normal-font-size">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
<!-- wp:column {"width":33.33} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- wp:paragraph {"fontSize":"normal"} -->
<p class="has-normal-font-size">Sed at orci ex. Nulla pulvinar, lorem vel eleifend maximus, nunc elit porta felis, id placerat orci dui sit amet ligula. Mauris fermentum dui quam, eget blandit ligula vulputate sit amet. Integer aliquet eget urna ac tempor. Nunc viverra faucibus magna ac aliquet. Integer ullamcorper lacinia elit quis gravida. Duis placerat pulvinar arcu nec faucibus. Sed sit amet enim iaculis, facilisis est non, venenatis nibh.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"right","style":{"color":{"text":"#ffffff"}}} -->
<p class="has-text-align-right has-text-color" style="color:#ffffff"><a href="/"> ' .esc_html__( 'View more...', 'tainacan-interface' ) . '</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
</div>
</div>
<!-- /wp:cover -->',
'categories' => array('tainacan-interface')
)
);
}
}
add_action( 'init', 'tainacan_block_patterns_init' );
/**
* get Tainacan's logo function HTML
*
* return custom or default Tainacan's logo
*/
function tainacan_get_logo() {
if ( has_custom_logo() ) {
return get_custom_logo();
} else {
$html = '<a class="navbar-brand tainacan-logo" href="' . esc_url( home_url() ) . '">';
$html .= '<h1>' . get_bloginfo( 'name' ) . '</h1>';
$html .= '</a>';
return $html;
}
}
/**
* Change logo class function
*
* @param [type] $html
* @return void
*/
function tainacan_change_logo_class( $html ) {
$html = str_replace( 'custom-logo-link', 'navbar-brand tainacan-logo', $html );
$html = str_replace( 'custom-logo', 'logo', $html );
return $html;
}
add_filter( 'get_custom_logo', 'tainacan_change_logo_class' );
/**
* Class navwalker
*/
require_once get_template_directory() . '/lib/class-wp-bootstrap-navwalker.php';
/**
* Register the menu for use after the banner
*/
register_nav_menus( array(
'navMenubelowHeader' => __( 'Navigation menu below header', 'tainacan-interface' ),
) );
function tainacan_hex2rgb( $color ) {
$color = trim( $color, '#' );
if ( strlen( $color ) === 3 ) {
$r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
$g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
$b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
} elseif ( strlen( $color ) === 6 ) {
$r = hexdec( substr( $color, 0, 2 ) );
$g = hexdec( substr( $color, 2, 2 ) );
$b = hexdec( substr( $color, 4, 2 ) );
} else {
return array();
}
return array(
'red' => $r,
'green' => $g,
'blue' => $b,
);
}
function tainacan_collections_viewmode( $public_query_vars ) {
$public_query_vars[] = 'tainacan_collections_viewmode';
return $public_query_vars;
}
add_filter( 'query_vars', 'tainacan_collections_viewmode' );
function tainacan_active( $selected, $current = true, $echo = true ) {
$return = $selected == $current ? 'active' : '';
if ( $echo ) {
echo $return;
}
return $return;
}
function tainacan_theme_collection_title( $title ) {
if ( is_post_type_archive( 'tainacan-collection' ) ) {
return __( 'Collections', 'tainacan-interface' );
}
return $title;
}
add_filter( 'get_the_archive_title', 'tainacan_theme_collection_title' );
function tainacan_theme_collection_query( $query ) {
if ( $query->is_main_query() && $query->is_post_type_archive( 'tainacan-collection' ) ) {
$query->set( 'posts_per_page', 12 );
}
}
add_action( 'pre_get_posts', 'tainacan_theme_collection_query' );
/**
* Render customizer colors to Gutenberg.
*/
function tainacan_customizer_gutenberg_colors() {
// Retrieve the link color from the Customizer.
$link_color = get_theme_mod( 'tainacan_link_color', 'default' );
// Build styles.
$css = '';
$css .= '.has-accent-color { color: ' . esc_attr( $link_color ) . ' !important; }';
$css .= '.has-accent-background-color { background-color: ' . esc_attr( $link_color ) . '; }';
return wp_strip_all_tags( $css );
}
/**
* Enqueue editor styles for Gutenberg
*/
function tainacan_editor_styles() {
// Adds Tainacan editor style for Gutenberg.
wp_enqueue_style( 'tainacan-editor-style', get_template_directory_uri() . '/editor-style.css', [], TAINACAN_INTERFACE_VERSION );
// Adds Robot fonts to Gutenberg.
wp_enqueue_style( 'RobotoFonts', 'https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i' );
}
add_action( 'enqueue_block_editor_assets', 'tainacan_editor_styles' );
require get_template_directory() . '/functions/customizer.php';
require get_template_directory() . '/functions/single-functions.php';
require get_template_directory() . '/functions/class-tainacanthemecollectioncolor.php';
require get_template_directory() . '/functions/breadcrumb.php';