-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
151 lines (140 loc) · 3.99 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
<?php
/**
* Setup
*/
if ( ! function_exists( 'prutser_setup' ) ) :
function prutser_setup() {
load_theme_textdomain( 'prutser', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support(
'html5',
array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' )
);
register_nav_menus(
array(
'menu-top' => __( 'Top Menu', 'prutser' ),
)
);
}
endif;
add_action( 'after_setup_theme', 'prutser_setup' );
if ( ! function_exists( 'prutser_content_width' ) ) :
function prutser_content_width() {
$GLOBALS['content_width'] = apply_filters( 'prutser_content_width', 640 );
}
endif;
add_action( 'after_setup_theme', 'prutser_content_width', 0 );
if ( ! function_exists( 'prutser_scripts' ) ) :
function prutser_scripts() {
$theme = wp_get_theme();
wp_enqueue_style(
'prutser',
get_stylesheet_uri(),
array(),
$theme->get( 'Version' )
);
// Required for Bootstrap
wp_enqueue_script(
'popperjs',
get_template_directory_uri() . '/assets/js/popper.min.js',
array(),
'2.11.6',
true
);
// Bootstrap 5
wp_enqueue_script(
'bootstrap',
get_template_directory_uri() . '/assets/js/bootstrap.min.js',
array(),
'5.2.0',
true
);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
endif;
add_action( 'wp_enqueue_scripts', 'prutser_scripts' );
if ( ! function_exists( 'prutser_widgets_init' ) ) :
function prutser_widgets_init() {
register_sidebar(
array(
'name' => __( 'Navbar', 'prutser' ),
'id' => 'navbar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Sidebar', 'prutser' ),
'id' => 'sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2 class="widget-title">', //NOSONAR
'after_title' => '</h2>', //NOSONAR
)
);
register_sidebar(
array(
'name' => __( 'Footer Left', 'prutser' ),
'id' => 'footer-left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2 class="widget-title">', //NOSONAR
'after_title' => '</h2>', //NOSONAR
)
);
register_sidebar(
array(
'name' => __( 'Footer Middle', 'prutser' ),
'id' => 'footer-middle',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2 class="widget-title">', //NOSONAR
'after_title' => '</h2>', //NOSONAR
)
);
register_sidebar(
array(
'name' => __( 'Footer Right', 'prutser' ),
'id' => 'footer-right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2 class="widget-title">', //NOSONAR
'after_title' => '</h2>', //NOSONAR
)
);
}
endif;
add_action( 'widgets_init', 'prutser_widgets_init' );
/**
* NavWalker (for menu's)
*/
if ( ! function_exists( 'prutser_register_navwalker' ) ) :
function prutser_register_navwalker() {
require_once get_template_directory() . '/classes/class-wp-bootstrap-navwalker.php';
}
endif;
add_action( 'after_setup_theme', 'prutser_register_navwalker' );
function prefix_bs5_dropdown_data_attribute( $atts, $item, $args ) { //NOSONAR
if ( is_a( $args->walker, 'WP_Bootstrap_Navwalker' ) && ( array_key_exists( 'data-toggle', $atts ) ) ) {
unset( $atts['data-toggle'] );
$atts['data-bs-toggle'] = 'dropdown';
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'prefix_bs5_dropdown_data_attribute', 20, 3 );
/**
* Template Tags
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Remove WordPress update notifications
*/
add_filter( 'auto_core_update_send_email', '__return_false' ); //NOSONAR
add_filter( 'auto_plugin_update_send_email', '__return_false' ); //NOSONAR
add_filter( 'auto_theme_update_send_email', '__return_false' ); //NOSONAR