-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
91 lines (76 loc) · 2.98 KB
/
Copy pathfunctions.php
File metadata and controls
91 lines (76 loc) · 2.98 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Fancy Labs functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Fancy Lab
*/
require_once get_template_directory() . '/inc/customizer.php';
function fancy_lab_scripts() {
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/inc/bootstrap.min.js', array( 'jquery' ), '4.4.1', true );
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/inc/bootstrap.min.css', array(), '4.4.1', 'all' );
//Theme's main stylesheet
wp_enqueue_style( 'fancy-lab-style', get_stylesheet_uri(), array(), filemtime( get_template_directory() . '/style.css' ), 'all' );
//Google Fonts
wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css?family=Rajdhani:400,500,600,700|Seaweed+Script' );
//Flexslider
wp_enqueue_style( 'flexslider-css', get_template_directory_uri() . '/inc/flexslider/flexslider.css', array(), '2.7.2', 'all' );
wp_enqueue_script( 'flexslider-min-js', get_template_directory_uri() . '/inc/flexslider/jquery.flexslider-min.js', array( 'jquery' ), '2.7.2', true );
wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/inc/flexslider/flexslider.js', array( 'jquery' ), '2.7.2', true );
}
add_action( 'wp_enqueue_scripts', 'fancy_lab_scripts' );
function fancy_lab_config() {
//Bootstrap Menu
require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
register_nav_menus (
array(
'fancy_lab_main_menu' => 'Fancy Lab Menu',
'fancy_lab_footer_menu' => 'Fancy Lab Footer Menu'
)
);
add_theme_support( 'woocommerce', array(
'thumbnail_image_width' => 255,
'single_image_width' => 255,
'product_grid' => array(
'default_rows' => 10,
'min_rows' => 5,
'max_rows' => 10,
'default_columns' => 1,
'min_columns' => 1,
'max_columns' => 1
)
) );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'custom-logo', array(
'height' => 85,
'width' => 160,
'flex_height' => true,
'flex_width' => true
) );
//Dimensões padrão para imagens do slide
add_image_size( 'fancy_lab_slider', 1920, 800, array( 'center', 'center' ) );
if ( ! isset( $content_width ) ) {
$content_width = 600;
}
}
add_action( 'after_setup_theme', 'fancy_lab_config', 0 ); // 0: prioridade de execução > após after_setup_theme
// Se o WooCommerce estiver instalado, importa o arquivo adaptado a nosso tema
if( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/wc-modifications.php';
}
/**
* Show cart contents / total Ajax
*/
add_filter( 'woocommerce_add_to_cart_fragments', 'fancy_lab_woocommerce_header_add_to_cart_fragment' );
function fancy_lab_woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<span class="items"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
<?php
$fragments['span.items'] = ob_get_clean();
return $fragments;
}