forked from livecanvas-team/picostrap5-child-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
61 lines (44 loc) · 3.27 KB
/
Copy pathfunctions.php
File metadata and controls
61 lines (44 loc) · 3.27 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
<?php
/*
_ _ _____ _ _ _ _ _ _
(_) | | | ____| | | (_) | | | | | | |
_ __ _ ___ ___ ___| |_ _ __ __ _ _ __| |__ ___| |__ _| | __| | | |_| |__ ___ _ __ ___ ___
| '_ \| |/ __/ _ \/ __| __| '__/ _` | '_ \___ \ / __| '_ \| | |/ _` | | __| '_ \ / _ \ '_ ` _ \ / _ \
| |_) | | (_| (_) \__ \ |_| | | (_| | |_) |__) | | (__| | | | | | (_| | | |_| | | | __/ | | | | | __/
| .__/|_|\___\___/|___/\__|_| \__,_| .__/____/ \___|_| |_|_|_|\__,_| \__|_| |_|\___|_| |_| |_|\___|
| | | |
|_| |_|
*************************************** WELCOME TO PICOSTRAP ***************************************
********************* THE BEST WAY TO EXPERIENCE SASS, BOOTSTRAP AND WORDPRESS *********************
PLEASE WATCH THE VIDEOS FOR BEST RESULTS:
https://www.youtube.com/playlist?list=PLtyHhWhkgYU8i11wu-5KJDBfA9C-D4Bfl
*/
//LOAD LC CONFIG TO DEFINE FRAMEWORK
require_once ("livecanvas/configuration.php");
// DE-ENQUEUE PARENT THEME BOOTSTRAP JS BUNDLE
add_action( 'wp_print_scripts', function(){
wp_dequeue_script( 'bootstrap5' );
//wp_dequeue_script( 'dark-mode-switch' ); //optionally
}, 100 );
// ENQUEUE THE BOOTSTRAP JS BUNDLE (AND EVENTUALLY MORE LIBS) FROM THE CHILD THEME DIRECTORY
add_action( 'wp_enqueue_scripts', function() {
//enqueue js in footer, defer
wp_enqueue_script( 'bootstrap5-childtheme', get_stylesheet_directory_uri() . "/js/bootstrap.bundle.min.js", array(), null, array('strategy' => 'defer', 'in_footer' => true) );
//optional: example of how to globally lazyload js files eg lottie player, using defer
//wp_enqueue_script( 'lottie-player', 'https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js', array(), null, array('strategy' => 'defer', 'in_footer' => true) );
}, 101);
// HACK HERE: ENQUEUE YOUR CUSTOM JS FILES, IF NEEDED
add_action( 'wp_enqueue_scripts', function() {
//UNCOMMENT next row to include the js/custom.js file globally
//wp_enqueue_script('custom', get_stylesheet_directory_uri() . '/js/custom.js', array(/* 'jquery' */), null, array('strategy' => 'defer', 'in_footer' => true) );
//UNCOMMENT next 3 rows to load the js file only on one page
//if (is_page('mypageslug')) {
// wp_enqueue_script('custom', get_stylesheet_directory_uri() . '/js/custom.js', array(/* 'jquery' */), null, array('strategy' => 'defer', 'in_footer' => true) );
//}
}, 102);
// OPTIONAL: ADD MORE NAV MENUS
//register_nav_menus( array( 'third' => __( 'Third Menu', 'picostrap' ), 'fourth' => __( 'Fourth Menu', 'picostrap' ), 'fifth' => __( 'Fifth Menu', 'picostrap' ), ) );
// THEN USE SHORTCODE: [lc_nav_menu theme_location="third" container_class="" container_id="" menu_class="navbar-nav"]
// OPTIONAL: FOR SECURITY: DISABLE APPLICATION PASSWORDS. Uncomment if needed
//add_filter( 'wp_is_application_passwords_available', '__return_false' );
// ADD YOUR CUSTOM PHP CODE DOWN BELOW /////////////////////////