-
Notifications
You must be signed in to change notification settings - Fork 18
/
functions.php
71 lines (55 loc) · 2 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
<?php
if ( ! defined( 'MAERA_ASSETS_URL' ) ) {
define( 'MAERA_ASSETS_URL', get_stylesheet_directory_uri() . '/assets' );
}
// If the Timber plugin is not already installed, load it from the theme.
if ( ! class_exists( 'Timber' ) ) {
require_once locate_template( '/lib/timber-library/timber.php' );
}
// Include the Kirki Advanced Customizer
if ( ! class_exists( 'Kirki' ) ) {
require_once locate_template( '/lib/kirki/kirki.php' );
}
require_once locate_template( '/lib/breadcrumb-trail.php' );
require_once locate_template( '/framework/framework.php' );
require_once locate_template( '/lib/init.php' );
require_once locate_template( '/lib/class-Maera_Color.php' );
require_once locate_template( '/lib/class-Maera_Image.php' );
require_once locate_template( '/lib/class-Maera_Posts.php' );
require_once locate_template( '/lib/widgets.php' );
require_once locate_template( '/lib/utils.php' );
require_once locate_template( '/lib/customizer.php' );
require_once locate_template( '/lib/admin-page.php' );
require_once locate_template( '/lib/assets.php' );
if ( ! isset( $content_width ) ) {
$content_width = apply_filters( 'maera/content_width', 960 );
}
/**
* Add and remove body_class() classes
*/
function maera_body_class( $classes ) {
// Add post/page slug
if ( is_single() || is_page() && ! is_front_page() ) {
$permalink = basename( get_permalink() );
$classes[] = maera_transliterate( $permalink );
}
$classes[] = get_theme_mod( 'framework', 'bootstrap' );;
// Remove unnecessary classes
$home_id_class = 'page-id-' . get_option( 'page_on_front' );
$remove_classes = array(
'page-template-default',
$home_id_class
);
$classes = array_diff( $classes, $remove_classes );
return $classes;
}
add_filter( 'body_class', 'maera_body_class' );
/**
* Tell WordPress to use searchform.php from the templates/ directory
*/
function maera_get_search_form( $form ) {
$form = '';
locate_template( '/searchform.php', true, false );
return $form;
}
add_filter( 'get_search_form', 'maera_get_search_form' );