-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
77 lines (70 loc) · 2.11 KB
/
functions.php
File metadata and controls
77 lines (70 loc) · 2.11 KB
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
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Register Theme Scripts
* https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/
*/
function ditto_scripts() {
wp_enqueue_style( 'core', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'main-styles', get_template_directory_uri() . '/css/main.bundle.css' );
wp_enqueue_script( 'main-scripts', get_template_directory_uri() . '/js/main.bundle.js', array( 'jquery' ), '', true );
}
add_action( 'wp_enqueue_scripts', 'ditto_scripts');
/**
* Register Navigation Menus
* https://developer.wordpress.org/reference/functions/register_nav_menus/
*/
function ditto_navigation_menus() {
$locations = array(
'main_menu' => __( 'Main Menu', 'text_domain' )
);
register_nav_menus( $locations );
}
add_action( 'init', 'ditto_navigation_menus' );
/**
* Theme support
* https://developer.wordpress.org/reference/functions/add_theme_support/
*/
add_theme_support( 'custom-logo' );
/**
* Login Styles
*/
function ditto_login_styles() { ?>
<style type="text/css">
body {
background-color: #222 !important;
}
#login h1 a, .login h1 a {
display: none;
}
#login h1 img {
width: 100%;
max-width: 240px;
max-height: 180px;
}
</style>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
let loginImg = document.createElement("img");
loginImg.src = "<?= get_template_directory_uri() ?>/images/pipe-code-logo.svg";
loginImg.alt = "WordPress login image";
document.querySelector('#login h1').appendChild(loginImg);
});
</script>
<?php }
add_action( 'login_enqueue_scripts', 'ditto_login_styles' );
/**
* Install latest jQuery version 3.5.1
*/
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
/**
* Disable Gutenberg
*/
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter('use_block_editor_for_post_type', '__return_false', 10);