forked from hrsetyono/edje-wp-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
103 lines (86 loc) · 2.73 KB
/
functions.php
File metadata and controls
103 lines (86 loc) · 2.73 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
<?php
require_once __DIR__ . '/_lib/helpers.php';
// Abort if required plugins is inactive
if (!Helper::has_required_plugins()) { return; }
$THEME = wp_get_theme();
define('MY_VERSION', $THEME->get('Version'));
define('MY_NAMESPACE', 'my/v1');
define('MY_DIST', get_stylesheet_directory_uri() . '/_dist');
define('MY_IMAGES', get_stylesheet_directory_uri() . '/images');
require_once __DIR__ . '/modules/modules.php';
require_once __DIR__ . '/gutenberg/gutenberg.php';
if (class_exists('WooCommerce')) {
require_once __DIR__ . '/woocommerce/_shop-functions.php';
}
// Initial setup
my_before_setup_theme();
add_action('after_setup_theme', 'my_after_setup_theme');
add_action('acf/input/admin_footer', 'my_acf_change_color_palette');
/////
/**
* Function that run first
*/
function my_before_setup_theme() {
// Do something
}
/**
* Setup theme supports
*
* @action after_setup_theme
*/
function my_after_setup_theme() {
add_theme_support('post-thumbnails');
add_theme_support('menus');
add_theme_support('custom-logo');
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('html5', [
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'navigation-widgets', 'style', 'script'
]);
add_post_type_support('page', 'excerpt'); // allow page to have excerpt
// Pixel Library Support
add_theme_support('px-megamenu');
add_theme_support('px-faq-block');
add_theme_support('px-icon-block', 'v6'); // v6-regular, v6-light, v6-duotone
add_theme_support('px-tabs-block');
add_theme_support('h-comment-editor'); // Enable this if you allow comment in the website
// Gutenberg support
add_theme_support('responsive-embeds');
remove_theme_support('core-block-patterns');
// Nav
register_nav_menu('main-menu', 'Main Menu');
register_nav_menu('footer-menu', 'Footer Menu');
}
// add_action('widgets_init', 'my_widgets_init');
// function my_widgets_init() {
// register_sidebar([
// 'name' => 'Sidebar',
// 'id' => 'sidebar',
// 'description' => 'Appear besides post',
// 'before_widget' => '<div id="%1$s" class="widget %2$s">',
// 'after_widget' => '</div>',
// 'before_title' => '<h3 class="widgettitle">',
// 'after_title' => '</h3>',
// ]);
// }
/**
* Change the palette on ACF Color Picker
*
* @action acf/input/admin_footer
* @todo - don't forget to change accordingly if you use ACF Color Picker
*/
function my_acf_change_color_palette() { ?>
<script>
(function() {
acf.add_filter('color_picker_args', function(args, $field) {
args.palettes = [
'#5C6BC0', '#D3D7EE',
'#2ecc71', '#def7e8',
'#e74c3c', '#fbdedb',
'#252427', '#ffffff'
];
return args;
});
})();
</script>
<?php }