-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·199 lines (151 loc) · 6.24 KB
/
functions.php
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Set Localization (do not remove)
load_child_theme_textdomain( 'minimum', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'minimum' ) );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', __( 'Minimum Pro Theme', 'minimum' ) );
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/minimum/' );
define( 'CHILD_THEME_VERSION', '3.0.1' );
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'minimum_enqueue_scripts' );
function minimum_enqueue_scripts() {
wp_enqueue_script( 'minimum-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'dashicons' );
}
//* Add new image sizes
add_image_size( 'portfolio', 540, 340, TRUE );
//* Add support for custom background
add_theme_support( 'custom-background', array( 'wp-head-callback' => 'minimum_background_callback' ) );
//* Add custom background callback for background color
function minimum_background_callback() {
if ( ! get_background_color() )
return;
printf( '<style>body { background-color: #%s; }</style>' . "\n", get_background_color() );
}
//* Add support for custom header
add_theme_support( 'custom-header', array(
'width' => 320,
'height' => 60,
'header-selector' => '.site-title a',
'header-text' => false
) );
//* Add support for structural wraps
add_theme_support( 'genesis-structural-wraps', array(
'header',
'site-tagline',
'nav',
'subnav',
'home-featured',
'site-inner',
'footer-widgets',
'footer'
) );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
//* Unregister layout settings
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
//* Unregister secondary sidebar
unregister_sidebar( 'sidebar-alt' );
//* Remove site description
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_after_header', 'genesis_do_nav', 15 );
//* Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_footer', 'genesis_do_subnav', 7 );
//* Reduce the secondary navigation menu to one level depth
add_filter( 'wp_nav_menu_args', 'minimum_secondary_menu_args' );
function minimum_secondary_menu_args( $args ){
if( 'secondary' != $args['theme_location'] )
return $args;
$args['depth'] = 1;
return $args;
}
//* Add the site tagline section
add_action( 'genesis_after_header', 'minimum_site_tagline' );
function minimum_site_tagline() {
printf( '<div %s>', genesis_attr( 'site-tagline' ) );
genesis_structural_wrap( 'site-tagline' );
printf( '<div %s>', genesis_attr( 'site-tagline-left' ) );
printf( '<p %s>%s</p>', genesis_attr( 'site-description' ), esc_html( get_bloginfo( 'description' ) ) );
echo '</div>';
printf( '<div %s>', genesis_attr( 'site-tagline-right' ) );
genesis_widget_area( 'site-tagline-right' );
echo '</div>';
genesis_structural_wrap( 'site-tagline', 'close' );
echo '</div>';
}
//* Hook after post widget after the entry content
add_action( 'genesis_after_entry', 'minimum_after_entry', 5 );
function minimum_after_entry() {
if ( is_singular( 'post' ) )
genesis_widget_area( 'after-entry', array(
'before' => '<div class="after-entry widget-area">',
'after' => '</div>',
) );
}
//* Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'minimum_author_box_gravatar' );
function minimum_author_box_gravatar( $size ) {
return 144;
}
//* Modify the size of the Gravatar in the entry comments
add_filter( 'genesis_comment_list_args', 'minimum_comments_gravatar' );
function minimum_comments_gravatar( $args ) {
$args['avatar_size'] = 96;
return $args;
}
//* Change the number of portfolio items to be displayed (props Bill Erickson)
add_action( 'pre_get_posts', 'minimum_portfolio_items' );
function minimum_portfolio_items( $query ) {
if ( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) {
$query->set( 'posts_per_page', '6' );
}
}
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'minimum_remove_comment_form_allowed_tags' );
function minimum_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
//* Register widget areas
genesis_register_sidebar( array(
'id' => 'site-tagline-right',
'name' => __( 'Site Tagline Right', 'minimum' ),
'description' => __( 'This is the site tagline right section.', 'minimum' ),
) );
genesis_register_sidebar( array(
'id' => 'home-featured-1',
'name' => __( 'Home Featured 1', 'minimum' ),
'description' => __( 'This is the home featured 1 section.', 'minimum' ),
) );
genesis_register_sidebar( array(
'id' => 'home-featured-2',
'name' => __( 'Home Featured 2', 'minimum' ),
'description' => __( 'This is the home featured 2 section.', 'minimum' ),
) );
genesis_register_sidebar( array(
'id' => 'home-featured-3',
'name' => __( 'Home Featured 3', 'minimum' ),
'description' => __( 'This is the home featured 3 section.', 'minimum' ),
) );
genesis_register_sidebar( array(
'id' => 'home-featured-4',
'name' => __( 'Home Featured 4', 'minimum' ),
'description' => __( 'This is the home featured 4 section.', 'minimum' ),
) );
genesis_register_sidebar( array(
'id' => 'after-entry',
'name' => __( 'After Entry', 'minimum' ),
'description' => __( 'This is the after entry widget area.', 'minimum' ),
) );
// gn fichiers perso
require_once( CHILD_DIR.'/lib-gn/functions-sup.php' );