-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
117 lines (98 loc) · 2.72 KB
/
Copy pathfunctions.php
File metadata and controls
117 lines (98 loc) · 2.72 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
// Support for TGM required plugins
require_once get_template_directory() . '/inc/TGM/class-tgm-plugin-activation.php';
add_action('tgmpa_register', 'TGM_register_required_plugins');
function TGM_register_required_plugins(){
$plugins = array(
array('name' => 'Classic Editor',
'slug' => 'classic-editor',
'required' => false)
);
$config = array(
'id' => 'TGM',
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'parent-slug' => 'themes.php',
'capability' => 'edit_theme_options',
'has_notices' => true,
'dismissable' => true,
'dismiss_msg' => '',
'is_automatic' => false,
'message' => ''
);
tgmpa($plugins, $config);
}
function load_stylesheets()
{
wp_register_style('stylesheet', get_template_directory_uri() . '/style.css', '', 1, 'all');
wp_enqueue_style('stylesheet');
wp_register_style('custom', get_template_directory_uri() . '/app.css', '', 1, 'all');
wp_enqueue_style('custom');
}
add_action('wp_enqueue_scripts', 'load_stylesheets');
function load_javascript()
{
wp_register_script('custom', get_template_directory_uri() . '/app.js', 'jquery', 1, true);
wp_enqueue_script('custom');
}
add_action('wp_enqueue_scripts', 'load_javascript');
// Add support
add_theme_support('menus');
add_theme_support('post-thumbnails');
// Add custom logo branding
add_theme_support( 'custom-logo', array(
'height' => 100,
'flex-width' => true
));
// Add dynamic hero images
$customHeader = array(
'default-image' => get_template_directory_uri() . '/images/hero.jpg',
'uploads' => true,
);
add_theme_support('custom-header', $customHeader);
add_theme_support('custom-background');
// WooCommerce support
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
// Register menu
register_nav_menus(
array(
'top-menu' => __('Top Menu', 'theme'),
)
);
// Register footer menu
register_nav_menus(
array(
'footer-menu' => __('Footer menu', 'theme'),
)
);
// Add image sizes
add_image_size('post_image', 1100, 550, false);
add_image_size('woocommerce_gallery_thumbnail', 100, 100, true);
add_image_size('woocommerce_thumbnail', 600, 600, true);
// Add widget
register_sidebar(
array(
'name' => 'Page Sidebar',
'id' => 'page-sidebar',
'class' => '',
'before_title' => '<h4>',
'after_title' => '</h4>'
)
);
register_sidebar(
array(
'name' => 'Blog Sidebar',
'id' => 'blog-sidebar',
'class' => '',
'before_title' => '<h4>',
'after_title' => '</h4>'
)
);
// Count how many items account menu have to display
function wc_get_account_menu_items_length(){
return count(wc_get_account_menu_items());
}
add_action('woocommerce_before_account_navigation', 'wc_get_account_menu_items_length');