This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
169 lines (135 loc) · 4.11 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/**
* main.php File
*
* >------------------>
*
* 1 Globals
*
* 1.1 Theme Resources URI
*
* 2 Theme Functionality
*
* 2.1 » Core Functions & Libraries
*
* 2.2 » Head Meta & Link Tags
* 2.3 » Fonts
* 2.4 » Navigation Menus
* 2.5 » Sidebars
* 2.6 » Thumbnails
* 2.7 » Titles
* 2.8 » Entry Meta
* 2.9 » Comments
* 2.10 » Page Links
* 2.11 » No Post Found
*
* 2.12 » Admin Area
*
* 3 After Setup Theme Actions
*
* 3.1 Language Support
* 3.2 Cleanup
* 3.3 Load Base Scripts & Styles
* 3.4 Custom Theme Features
* 3.5 Register Sidebars
*
* 4 » External Libraries
*
* 5 Custom Functions, Actions & Filters
*
* <------------------<
*
* @link https://developer.wordpress.org/reference/
*/
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
/**
* 1 GLOBALS
* ************************************************************
*/
/**
* 1.1 Returns the theme resources URI, with an optional $subpath parameter
* NOTE: This must match the THEME_RES global in /gulpfile.js
*/
function medula_get_theme_resources_uri( $subpath = '' ){
return get_template_directory_uri() . '/res/' . $subpath;
}
/**
* 2 THEME FUNCTIONALITY
* ************************************************************
*
* @link https://github.com/andamira/medula/wiki/Theme_includes
*/
/**
* 2.1 Core Functions & Libraries
*
* Enqueue styles & scripts, theme support, cleanup...
*/
require_once get_theme_file_path( 'lib/main.php' );
/**
* 2.2 General Functionality
*/
require_once get_theme_file_path( 'lib/head-tags.php' ); // Meta Tags, Favicons, etc.
require_once get_theme_file_path( 'lib/fonts.php' ); // Load External Fonts
require_once get_theme_file_path( 'lib/navigation.php' ); // Register Menus
require_once get_theme_file_path( 'lib/sidebars.php' ); // Register Sidebars
require_once get_theme_file_path( 'lib/thumbnails.php' ); // Thumbnails and Default Sizes
require_once get_theme_file_path( 'lib/titles.php' ); // Entry Title Function
require_once get_theme_file_path( 'lib/entry-meta.php' ); // Entry Meta Fields Functions
require_once get_theme_file_path( 'lib/comments.php' ); // Comments Functions
require_once get_theme_file_path( 'lib/links.php' ); // Page Links Function
require_once get_theme_file_path( 'lib/post-not-found.php' ); // Post Not Found Function
/**
* 2.3 Admin Area
*
* Default Widgets, Admin Bar, Theme Customizer, etc.
*/
require_once get_theme_file_path( 'lib/admin/main.php' );
/**
* 3 AFTER SETUP THEME
* ************************************************************
*
* Functions defined in /theme/lib/medula.php
*/
add_action( 'after_setup_theme', 'medula_launch' );
function medula_launch() {
/**
* 3.1 language support
*
* @link https://developer.wordpress.org/themes/functionality/internationalization/
*/
load_theme_textdomain( 'medula', get_template_directory() . '/i18n' );
/**
* 3.2 cleanup
*/
medula_cleanup_all();
/**
* 3.3 enqueue base scripts and styles
*/
add_action( 'wp_enqueue_scripts', 'medula_scripts_and_styles', 999 );
/**
* 3.4 custom theme features
*/
medula_theme_support();
/**
* 3.5 register sidebars ( sidebars are defined in /theme/lib/sidebars.php )
*/
add_action( 'widgets_init', 'medula_register_sidebars' );
}
/**
* 4 EXTERNAL LIBRARIES & PLUGINS
* ************************************************************
*
* This file controls the inclusion of third party libraries,
* including fixes & cleanups for external libraries and also
* for some big plugins like like WPML, Toolset & WooCommerce.
*/
include_once get_theme_file_path( 'lib/vendor/main.php' );
/**
* 5 CUSTOM FUNCTIONS, ACTIONS & FILTERS
* ************************************************************
*
* Here you could put some quick & dirty custom functions, but
* before doing that it would be better to take a look at the
* indexed sections above, and see if there are better places.
*/