-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
123 lines (111 loc) · 5.14 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
<?php
define( 'CUSTOMIZER_REPEATER_VERSION', '1.1.0' );
require_once get_template_directory() . '/inc/learnegy-post-meta.php';
require_once get_template_directory() . '/inc/learnegy-repeater.php';
require_once get_template_directory() . '/lib/learnegy-nav.php';
require_once get_template_directory() . '/inc/config/learnegy-customizer-config.php';
require_once get_template_directory() . '/inc/learnegy-plugins.php';
if(!function_exists('learnegy_theme_setup')) {
function learnegy_theme_setup() {
// Load Theme TextDomain
load_theme_textdomain('learnegy');
// Theme Supports
add_theme_support('title-tag');
add_theme_support('description');
add_theme_support('widgets');
add_theme_support('post-thumbnails');
add_theme_support('custom-header');
add_theme_support('custom-logo');
add_theme_support('custom-background');
add_theme_support( 'automatic-feed-links' );
add_theme_support(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
'navigation-widgets',
)
);
register_nav_menus(array(
'primary-menu' => __('Primary Menu', 'learnegy'),
));
}
add_action('after_setup_theme', 'learnegy_theme_setup');
}
function learnegy_assets_enqueue() {
// CSS Enqueue
wp_enqueue_style('learnegy_google-font', '//fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
wp_enqueue_style( 'learnegy_fontawesome-css', get_template_directory_uri().'/assets/css/all.css');
wp_enqueue_style( 'learnegy_bootstrap-css', get_template_directory_uri().'/assets/css/bootstrap.css');
wp_enqueue_style( 'learnegy_theme-style-css', get_template_directory_uri().'/assets/css/style.css');
wp_enqueue_style( 'learnegy_responsive-css', get_template_directory_uri().'/assets/css/responsive.css');
wp_enqueue_style('learnegy_main-css', get_stylesheet_uri());
// JS Enqueue
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'learnegy_popper-js', get_template_directory_uri().'/assets/js/popper.js', array('jquery'),
null, true );
wp_enqueue_script( 'learnegy_bootstrap-js', get_template_directory_uri().'/assets/js/bootstrap.js',
array('jquery'), null, true );
wp_enqueue_script( 'learnegy_main-js', get_template_directory_uri().'/assets/js/main.js', array('jquery'), null,
true );
}
add_action( 'wp_enqueue_scripts', 'learnegy_assets_enqueue' );
function learnegy_head_styles() {
?>
<style>
.news-letter-section {
background: url("<?php echo esc_url( get_theme_mod('learnegy_newsletter_bg_settings')); ?>");
background-size: cover;
background-repeat: no-repeat;
padding: 100px 0;
position: relative;
z-index: 11;
}
a:hover {
text-decoration: underline !important;
}
</style>
<?php
}
add_action('wp_head', 'learnegy_head_styles');
function learnegy_widgets() {
register_sidebar(array(
'name' => __('Newsletter Section', 'learnegy'),
'description' => __('Add newsletter shortcode or form in this area', 'learnegy'),
'id' => 'learnegy_newsletter_optin',
'before_widget' => '<div>',
'after_widget' => '</div>'
));
register_sidebar(array(
'name' => __('Blog Sidebar', 'learnegy'),
'description' => __('Blog archive page sidebar', 'learnegy'),
'id' => 'blog-sidebar',
'before_widget' => '<div>',
'after_widget' => '</div>'
));
register_sidebar(array(
'name' => __('Single Blog Sidebar', 'learnegy'),
'description' => __('Blog single post page sidebar', 'learnegy'),
'id' => 'blog-sidebar-single',
'before_widget' => '<div>',
'after_widget' => '</div>'
));
}
add_action('widgets_init', 'learnegy_widgets');
function learnegy_skip_link_focus_fix() {
?>
<script>
/(trident|msie)/i.test(navigator.userAgent) && document.getElementById && window.addEventListener && window
.addEventListener("hashchange", function () {
var t, e = location.hash.substring(1);
/^[A-z0-9_-]+$/.test(e) && (t = document.getElementById(e)) && (
/^(?:a|select|input|button|textarea)$/i.test(t.tagName) || (t.tabIndex = -1), t.focus())
}, !1);
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'learnegy_skip_link_focus_fix' );