-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
97 lines (82 loc) · 2.84 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
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
/* ================== Scripts/Styles ======================== */
function meta_resources() {
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/libraries/bootstrap.min.css');
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/libraries/all.min.css');
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '4.1.0', true );
wp_enqueue_script( 'webfont', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', array('jquery'), '1.6.26', true );
wp_enqueue_script( 'meta-js', get_template_directory_uri() . '/js/meta.js', array('jquery'), '1', true );
}
add_action('wp_enqueue_scripts', 'meta_resources');
// Add title tag to header
add_theme_support( 'title-tag' );
/* ================== Admin layouts ======================== */
/* Move Yoast to bottom */
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
/* Disable XML-RPC */
add_filter( 'xmlrpc_enabled', '__return_false' );
/* Enable Thumbnail Support */
add_theme_support( 'post-thumbnails' );
// Remove comments from admin bar
function my_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('comments');
}
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );
/* ================== Menus ======================== */
/* Add Menus */
function register_my_menus() {
register_nav_menus(
array(
'main-menu' => __( 'Main Menu' ),
'footer-menu' => __( 'Footer Menu' ),
)
);
}
add_action( 'init', 'register_my_menus' );
/* Add Wrappers for Sub Menus */
class megaMenu extends Walker_Nav_Menu {
// add classes to ul sub-menus
function start_lvl( &$output, $depth = 0, $args = array() ) {
// depth dependent classes
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
$classes = array(
'sub-menu',
'menu-depth-' . $display_depth
);
$class_names = implode( ' ', $classes );
// build html
if ($display_depth == 1) {
$output .= "\n" . $indent . '
<div class="sub-menu-wrap">
<div class="container">
<div class="row">
<ul class="' . $class_names . ' col-12">' . "\n";
} else {
$output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";
}
}
}
/* ================== ACF ======================== */
/* Add ACF Options Page */
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme Options',
'menu_title' => 'Theme Options',
'menu_slug' => 'theme-options',
'icon_url' => 'dashicons-admin-generic',
'position' => 6,
'capability' => 'edit_posts',
'redirect' => false
));
}
?>