-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
119 lines (94 loc) · 3.34 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
<?php
/**
* GT Next functions and definitions
*
* @package GT Next
*/
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function gt_next_setup() {
// Make theme available for translation.
load_theme_textdomain( 'gt-next', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Let WordPress manage the document title.
add_theme_support( 'title-tag' );
// Enable support for Post Thumbnails on posts and pages.
add_theme_support( 'post-thumbnails' );
// Set default Post Thumbnail size.
set_post_thumbnail_size( 1600, 900, true );
// Register Navigation Menus.
register_nav_menus( array(
'primary' => esc_html__( 'Main Navigation', 'gt-next' ),
'footer' => esc_html__( 'Footer Navigation', 'gt-next' ),
'social-header' => esc_html__( 'Social Icons (Header)', 'gt-next' ),
'social-footer' => esc_html__( 'Social Icons (Footer)', 'gt-next' ),
) );
}
add_action( 'after_setup_theme', 'gt_next_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function gt_next_content_width() {
// Set global variable for content width.
$GLOBALS['content_width'] = apply_filters( 'gt_next_content_width', 800 );
}
add_action( 'after_setup_theme', 'gt_next_content_width', 0 );
/**
* Enqueue scripts and styles.
*/
function gt_next_scripts() {
// Get Theme Version.
$theme_version = wp_get_theme()->get( 'Version' );
// Register and Enqueue Stylesheet.
wp_enqueue_style( 'gt-next-stylesheet', get_stylesheet_uri(), array(), $theme_version );
}
add_action( 'wp_enqueue_scripts', 'gt_next_scripts' );
/**
* Enqueue theme fonts.
*/
function gt_next_theme_fonts() {
$fonts_url = gt_next_get_fonts_url();
// Load Fonts if necessary.
if ( $fonts_url ) {
require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' );
wp_enqueue_style( 'gt-next-theme-fonts', wptt_get_webfont_url( $fonts_url ), array(), '20210105' );
}
}
add_action( 'wp_enqueue_scripts', 'gt_next_theme_fonts', 1 );
add_action( 'enqueue_block_editor_assets', 'gt_next_theme_fonts', 1 );
/**
* Retrieve webfont URL to load fonts locally.
*/
function gt_next_get_fonts_url() {
$font_families = array(
'Roboto:400,400italic,700,700italic',
'Inter:400,400italic,700,700italic',
);
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
'display' => urlencode( 'swap' ),
);
return apply_filters( 'gt_next_get_fonts_url', add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ) );
}
/**
* Include Files
*/
// Include Block Patterns.
require get_template_directory() . '/inc/block-patterns.php';
// Include Block Styles.
require get_template_directory() . '/inc/block-styles.php';
// Include Gutenberg Features.
require get_template_directory() . '/inc/gutenberg.php';
// Include Customization Features.
#require get_template_directory() . '/inc/custom-colors.php';
#require get_template_directory() . '/inc/custom-fonts.php';