-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
97 lines (84 loc) · 3.77 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
<?php
// Add scripts and stylesheets
function mw_scripts() {
//STYLESHEETS
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/components/bootstrap/dist/css/bootstrap.min.css' );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/components/font-awesome/css/font-awesome.min.css' );
wp_enqueue_style( 'normalize', get_template_directory_uri() . '/build/css/normalize.css' );
wp_enqueue_style( 'custom-css', get_template_directory_uri() . '/build/css/custom.css' );
//SCRIPTS FROM HERE!
wp_enqueue_script( 'jquery', get_template_directory_uri() . '/components/jquery/dist/jquery.js', array(), '1', true );
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/components/bootstrap/dist/js/bootstrap.min.js', array(), '1', true );
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/build/external-js/modernizr.custom.js', array( 'jquery' ), '1', true );
wp_enqueue_script( 'classie', get_template_directory_uri() . '/build/external-js/classie.js', array(), '1', true );
wp_enqueue_script( 'clipboard', get_template_directory_uri() . '/build/external-js/clipboard.min.js', array( 'classie' ), '1', true );
wp_enqueue_script( 'smoothscroll', get_template_directory_uri() . '/build/external-js/smooth-scroll.js', array( 'jquery' ), '1', true );
wp_enqueue_script( 'customjs', get_template_directory_uri() . '/build/js/custom.js', array(), '1', false );
}
add_action( 'wp_enqueue_scripts', 'mw_scripts' );
//true = load in footer
//false = load in head
function theme_setup(){
// WordPress Titles
add_theme_support( 'title-tag' );
// Support Featured Images
add_theme_support( 'post-thumbnails' );
// Adding menu to appear under appearence
add_theme_support( 'menus' );
}
add_action('init', 'theme_setup');
function register_my_menu(){
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action('after_setup_theme', 'register_my_menu');
function imagesSize() {
add_image_size( 'hard-crop-1', 300, 100, true ); // Hard Crop Mode
add_image_size( 'hard-crop-2', 400, 150, true ); // Hard Crop Mode
add_image_size( 'soft-crop-1', 300, 100, false ); // soft Crop Mode
add_image_size( 'soft-crop-2', 400, 150, false ); // soft Crop Mode
}
add_action( 'after_setup_theme', 'imagesSize', 15 );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'hard-crop-1' => __( 'Hard Crop Small' ),
'hard-crop-2' => __( 'Hard Crop Large' ),
'soft-crop-1' => __( 'Soft Crop Small' ),
'soft-crop-2' => __( 'Soft Crop Large' ),
) );
}
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
class Custom_Walker_Nav_Menu_top extends Walker_Nav_Menu
{
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$is_current_item = '';
if(array_search('current-menu-item', $item->classes) != 0)
{
$is_current_item = ' class="menu__item--current menu__item"';
}
else
{
$is_current_item = ' class="menu__item"';
}
echo '<li'.$is_current_item.'><a class="menu__link" href="'.$item->url.'">'.$item->title;
}
function end_el( &$output, $item, $depth = 0, $args = array() ) {
echo '</a></li>';
}
}
// remove width & height attributes from images
function remove_img_attr ($html)
{
return preg_replace('/(width|height)="\d+"\s/', "", $html);
}
add_filter( 'post_thumbnail_html', 'remove_img_attr' );
/*function my_custom_body_class_slug($classes) {
if ( is_page( 'contact' ) )
$classes[] = 'body-contact';
return $classes;
}
add_filter('body_class','my_custom_body_class_slug');
*/
//define('WP_DEBUG', true);
// define('WP_DEBUG_LOG', true);
// define('WP_DEBUG_DISPLAY', true);
// @ini_set('display_errors', 1);