-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
138 lines (116 loc) · 4.35 KB
/
functions.php
File metadata and controls
138 lines (116 loc) · 4.35 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
<?php
//Including all resourses for the site
function mwm_script_resourses()
{
//name, absolute path, dependencies, version, in_footer
wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', array(), '1.12.4', true);
}
add_action('wp_enqueue_scripts', 'mwm_script_resourses');
function mwm_style_resourses()
{
//name, absolute path, dependencies, version, media
wp_enqueue_style('bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css');
wp_enqueue_style('style', get_stylesheet_uri(), array(), '1.0.0', 'all');
wp_enqueue_style('font-awesome-5', 'https://use.fontawesome.com/releases/v5.5.0/css/all.css', array(), null);
wp_enqueue_style('math-with-mauritz-custom', get_stylesheet_directory_uri() . '/css/custom.css');
}
add_action('wp_enqueue_scripts', 'mwm_style_resourses');
function google_fonts()
{
//Av någon anledning knasar det med wp_enqueue_script
?>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,900" rel="stylesheet">
<?php
}
add_action('wp_head', 'google_fonts');
function add_scripts()
{
wp_register_script('custom_script', home_url() . '/wp-content/themes/math-with-mauritz/js/custom_script.js', array('jquery'));
wp_enqueue_script('custom_script');
}
add_action('wp_enqueue_scripts', 'add_scripts');
function favicon()
{ ?>
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<?php }
add_action('wp_head', 'favicon', 99);
//Theme support
function mwm_theme_setup()
{
//Featured Image Support
add_theme_support('post-thummwmails');
//width, height, hard-or soft cropping(hard)
add_image_size('small-thummwmail', 230, 144, true);
add_image_size('normal-thummwmail', 320, 380, true);
add_image_size('large-thummwmail', 500, 375, true);
}
add_action('after_setup_theme', 'mwm_theme_setup');
//Excerpt lenght control
function set_excerpt_length()
{
return 70;
}
add_filter('excerpt_length', 'set_excerpt_length');
//Menyer
//register Nav Walker class_alias
//require_once('wp-bootstrap-navwalker.php');
function mathWithMauritz_register_menus()
{
register_nav_menus(array(
'primary' => __('Primary Menu', 'math-with-mauritz'),
));
}
add_action('after_setup_theme', 'mathWithMauritz_register_menus');
//New file for customizing
require get_template_directory() . '/inc/customizer.php';
//Widget locations
function wpb_init_widgets($id)
{
//blog sidebar
register_sidebar(array(
'name' => 'Sidebar-blog',
'id' => 'sidebar-blog',
'before_widget' => '<div class="sidebar-module">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
}
add_action('widgets_init', 'wpb_init_widgets');
//ACF options page
if (function_exists('acf_add_options_page')) {
acf_add_options_page(array(
'page_title' => 'Theme Settings',
'menu_title' => 'Theme Settings',
'position' => 3.33,
));
}
function my_acf_admin_head()
{ ?>
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('.layout').addClass('-collapsed');
$('.acf-postbox').addClass('closed');
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_head', 'my_acf_admin_head');