-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththeme-setup.php
More file actions
108 lines (96 loc) · 2.6 KB
/
Copy paththeme-setup.php
File metadata and controls
108 lines (96 loc) · 2.6 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
<?php
/**
* Theme setup, including:
* - Theme supports
* - Image sizes
* - Nav menus
* - Sidebars/widget areas
* - Default theme options
*
* @file theme-setup.php
* @package CPT_Theme
* @since 1.0.0
*/
add_action( 'after_setup_theme', 'theme_setup' );
/**
* - Theme supports
* - Image sizes
* - Nav menus
*/
function theme_setup() {
add_theme_support(
'custom-logo',
array(
'height' => 480,
'width' => 720,
'flex-width' => true,
)
);
add_theme_support(
'html5',
array(
'caption',
'comment-form',
'comment-list',
'gallery',
'script',
'search-form',
'style',
)
);
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'title-tag' );
add_post_type_support( 'page', 'excerpt' );
add_image_size( 'tiny', 0, 90 );
register_nav_menu( 'primary', __( 'Primary Menu (In Header)', 'cpt-theme' ) );
register_nav_menu( 'secondary', __( 'Secondary Menu (Below Header)', 'cpt-theme' ) );
}
add_action( 'widgets_init', 'register_widget_areas' );
/**
* Register sidebars/widget areas.
*/
function register_widget_areas() {
register_sidebar(
array(
'id' => 'preheader-widgets',
'name' => __( 'Preheader Widget Area', 'cpt-theme' ),
'description' => __( 'Displayed above the main header.', 'cpt-theme' ),
)
);
register_sidebar(
array(
'id' => 'footer-widgets',
'name' => __( 'Footer Widget Area', 'cpt-theme' ),
'description' => __( 'Displayed in the footer.', 'cpt-theme' ),
)
);
}
add_action( 'after_switch_theme', 'default_options' );
/**
* Sets default theme options.
*/
function default_options() {
$default_options = array(
'cpt_sites_sticky_header' => false,
'cpt_sites_show_site_title' => true,
'cpt_sites_show_primary_menu' => true,
'cpt_sites_show_secondary_menu' => false,
'cpt_sites_show_primary_menu_cta' => false,
'cpt_sites_primary_menu_cta_text_color' => 'White',
'cpt_sites_primary_menu_cta_button_color' => 'Coral',
'cpt_sites_primary_menu_cta_text' => 'Contact Us',
'cpt_sites_primary_menu_cta_style' => 'link',
'cpt_sites_show_categories' => true,
'cpt_sites_show_tags' => true,
'cpt_sites_open_external_links_in_new_tab' => false,
'cpt_sites_show_external_link_icon' => false,
// Fonts moved to theme.json in 3.0.
// Colors moved to theme.json in 3.0.
);
foreach ( $default_options as $key => $val ) {
foreach ( $default_options as $key => $val ) {
add_option( $key, $val );
}
}
}