-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
100 lines (85 loc) · 2.86 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
<?php
/**
* Functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package WordPress
* @subpackage Naledi
* @since 0.1
*/
if ( ! function_exists( 'naledi_setup' ) ) {
/**
* 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.
*
* @since 0.1
*
* @return void
*/
function naledi_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Chia Blocks, use a find and replace
* to change 'naledi' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'naledi', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1568, 9999 );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue editor styles.
add_editor_style( array(
'./assets/css/blocks.css',
'./assets/css/style-shared.css'
) );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Add support for experimental link color control.
add_theme_support( 'experimental-link-color' );
// Add support for custom units.
add_theme_support( 'custom-units' );
}
}
add_action( 'after_setup_theme', 'naledi_setup' );
/**
* Enqueue scripts and styles.
*
* @since 0.1
*
* @return void
*/
function naledi_scripts() {
wp_enqueue_style( 'naledi-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
// Main navigation scripts.
wp_enqueue_script('naledi-primary-navigation-script', get_template_directory_uri() . '/assets/js/primary-navigation.js', array(), false, true );
}
add_action( 'wp_enqueue_scripts', 'naledi_scripts' );
/**
* Enqueue block editor script.
*
* @since 0.1
*
* @return void
*/
function naledi_block_editor_script() {
wp_enqueue_script( 'naledi-unregister-block-style', get_theme_file_uri( '/assets/js/unregister-block-style.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true );
}
add_action( 'enqueue_block_editor_assets', 'naledi_block_editor_script' );
// Block Patterns.
require get_template_directory() . '/inc/block-patterns.php';
// Block Styles.
require get_template_directory() . '/inc/block-styles.php';