This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
forked from digitoimistodude/air-light
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
105 lines (93 loc) · 3.17 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
<?php
/**
* Gather all bits and pieces together.
* If you end up having multiple post types, taxonomies,
* hooks and functions - please split those to their
* own files under /inc and just require here.
*
* @Date: 2019-10-15 12:30:02
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2020-01-22 14:16:53
*
* @package air-light
*/
/**
* The current version of the theme.
*/
define( 'AIR_LIGHT_VERSION', '4.9.9' );
/**
* Requires.
*/
require get_theme_file_path( '/inc/functions.php' );
require get_theme_file_path( '/inc/menus.php' );
require get_theme_file_path( '/inc/nav-walker.php' );
/**
* Enable theme support for essential features.
*/
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
// add_theme_support( 'woocommerce' );
/**
* Load textdomain.
*/
load_theme_textdomain( 'air-light', get_template_directory() . '/languages' );
/**
* Define content width in articles
*/
if ( ! isset( $content_width ) ) {
$content_width = 800;
}
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
add_action( 'widgets_init', 'air_light_widgets_init' );
function air_light_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'air-light' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'air-light' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
} // end air_light_widgets_init
/**
* Move jQuery to footer
*/
add_action( 'wp_default_scripts', 'air_light_move_jquery_into_footer' );
function air_light_move_jquery_into_footer( $wp_scripts ) {
if ( ! is_admin() ) {
$wp_scripts->add_data( 'jquery', 'group', 1 );
$wp_scripts->add_data( 'jquery-core', 'group', 1 );
$wp_scripts->add_data( 'jquery-migrate', 'group', 1 );
}
} // end air_light_move_jquery_into_footer
/**
* Enqueue scripts and styles.
*/
add_action( 'wp_enqueue_scripts', 'air_light_scripts' );
function air_light_scripts() {
if ( 'development' === getenv( 'WP_ENV' ) ) {
$air_light_template = 'global';
} else {
$air_light_template = 'global.min';
}
// Styles.
wp_enqueue_style( 'styles', get_theme_file_uri( "css/{$air_light_template}.css" ), array(), filemtime( get_theme_file_path( "css/{$air_light_template}.css" ) ) );
// Scripts.
wp_enqueue_script( 'jquery-core' );
wp_enqueue_script( 'scripts', get_theme_file_uri( 'js/all.js' ), array(), filemtime( get_theme_file_path( 'js/all.js' ) ), true );
// Required comment-reply script
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_localize_script( 'scripts', 'air_light_screenReaderText', array(
'expand' => esc_html__( 'Open child menu', 'air-light' ),
'collapse' => esc_html__( 'Close child menu', 'air-light' ),
) );
} // end air_light_scripts