4
4
5
5
use Roots \Sage \Assets ;
6
6
7
- /**
8
- * Enable theme features
9
- */
10
- add_theme_support ('soil-clean-up ' ); // Enable clean up from Soil
11
- add_theme_support ('soil-nav-walker ' ); // Enable cleaner nav walker from Soil
12
- add_theme_support ('soil-relative-urls ' ); // Enable relative URLs from Soil
13
- add_theme_support ('soil-nice-search ' ); // Enable nice search from Soil
14
- add_theme_support ('soil-jquery-cdn ' ); // Enable to load jQuery from the Google CDN
15
-
16
- /**
17
- * Configuration values
18
- */
19
- if (!defined ('DIST_DIR ' )) {
20
- // Path to the build directory for front-end assets
21
- define ('DIST_DIR ' , '/dist/ ' );
22
- }
23
-
24
7
/**
25
8
* Theme setup
26
9
*/
27
10
function setup () {
11
+ // Enable features from Soil when plugin is activated
12
+ // https://roots.io/plugins/soil/
13
+ add_theme_support ('soil-clean-up ' );
14
+ add_theme_support ('soil-nav-walker ' );
15
+ add_theme_support ('soil-nice-search ' );
16
+ add_theme_support ('soil-jquery-cdn ' );
17
+ add_theme_support ('soil-relative-urls ' );
18
+
28
19
// Make theme available for translation
29
20
// Community translations can be found at https://github.com/roots/sage-translations
30
21
load_theme_textdomain ('sage ' , get_template_directory () . '/lang ' );
@@ -39,21 +30,21 @@ function setup() {
39
30
'primary_navigation ' => __ ('Primary Navigation ' , 'sage ' )
40
31
]);
41
32
42
- // Add post thumbnails
33
+ // Enable post thumbnails
43
34
// http://codex.wordpress.org/Post_Thumbnails
44
35
// http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size
45
36
// http://codex.wordpress.org/Function_Reference/add_image_size
46
37
add_theme_support ('post-thumbnails ' );
47
38
48
- // Add post formats
39
+ // Enable post formats
49
40
// http://codex.wordpress.org/Post_Formats
50
41
add_theme_support ('post-formats ' , ['aside ' , 'gallery ' , 'link ' , 'image ' , 'quote ' , 'video ' , 'audio ' ]);
51
42
52
- // Add HTML5 markup for captions
43
+ // Enable HTML5 markup support
53
44
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
54
45
add_theme_support ('html5 ' , ['caption ' , 'comment-form ' , 'comment-list ' , 'gallery ' , 'search-form ' ]);
55
46
56
- // Tell the TinyMCE editor to use a custom stylesheet
47
+ // Custom stylesheet for visual editor
57
48
add_editor_style (Assets \asset_path ('styles/editor-style.css ' ));
58
49
}
59
50
add_action ('after_setup_theme ' , __NAMESPACE__ . '\\setup ' );
@@ -98,3 +89,17 @@ function display_sidebar() {
98
89
99
90
return apply_filters ('sage/display_sidebar ' , $ display );
100
91
}
92
+
93
+ /**
94
+ * Theme assets
95
+ */
96
+ function assets () {
97
+ wp_enqueue_style ('sage/css ' , Assets \asset_path ('styles/main.css ' ), false , null );
98
+
99
+ if (is_single () && comments_open () && get_option ('thread_comments ' )) {
100
+ wp_enqueue_script ('comment-reply ' );
101
+ }
102
+
103
+ wp_enqueue_script ('sage/js ' , Assets \asset_path ('scripts/main.js ' ), ['jquery ' ], null , true );
104
+ }
105
+ add_action ('wp_enqueue_scripts ' , __NAMESPACE__ . '\\assets ' , 100 );
0 commit comments