-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfunctions.php
More file actions
70 lines (63 loc) · 1.8 KB
/
functions.php
File metadata and controls
70 lines (63 loc) · 1.8 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
<?php
/**
* 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.
*
* @since 1.0.0
*/
use Lean\Config;
use Lean\Assets;
/**
* Action to load the configuration file and define constant values, this action
* has priority of 1 in order to be executed before any other action using the
* defined constant values on the config.php file.
*/
add_action( 'after_setup_theme', function(){
include 'config.php';
load_theme_textdomain( _TEXT_DOMAIN_ , _THEME_PATH_ . '/languages' );
}, 1);
/**
* Action created to add theme supports or specific of the theme.
*/
add_action( 'after_setup_theme', function(){
add_theme_support( 'post-thumbnails' );
});
/**
* Action that adds the styles from the theme to the editor in order to see the
* same styles from the front end in the dashboard on the editor section.
*/
add_action( 'after_setup_theme', function(){
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
add_editor_style( _THEME_PATH_ . '/assets/css/style.css' );
} else {
add_editor_style( _THEME_PATH_ . '/assets/css/style-min.css' );
}
});
/**
* Action that is responsable for register the menus used on the theme.
*/
add_action( 'after_setup_theme', function(){
register_nav_menu(
'primary-navigation',
__( 'Primary Menu', _TEXT_DOMAIN_ )
);
});
/**
* This actions register the assets and some configuration about the assets
* in order to load the CSS and JS files into the theme.
*/
add_action( 'after_setup_theme', function() {
$args = [
'css_version' => false,
'js_version' => time(),
'theme_path' => _THEME_URL_,
];
$assets = new Assets( $args );
$assets->load();
});
add_filter('loader_alias', function( $alias ) {
$alias['partial'] = 'partials';
return $alias;
});