forked from senlin/soblossom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
executable file
·246 lines (228 loc) · 8.31 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
/**
* functions and definitions
*
* @package soblossom
*/
/**
* Lineup of all required files:
*/
/**
* inc/soblossom.php - The blossom in soblossom, if you remove this, the sky will come falling down :)
* - theme setup soblossom_bloom()
* - textdomain
* - theme support
* - enqueue scripts and styles
* - add function soblossom_remove_script_version() (get rid of the ? in the script/style URLs)
* - register widget areas
* - register navigation menus
* - general cleanup (incl. injected styling, rss, generator, excerpt more and what not)
* - soblossom search form
*
* - add Foundation Features
*
* - Template Tags
* - soblossom_featured_image
* - soblossom_posted_in
* - soblossom_paging_nav
* - soblossom_post_nav
* - soblossom_posted_on
* - soblossom_categorized_blog
* - soblossom_comment
*
* - soblossom_body_classes
* - add functions soblossom_add_favicon
* - add filter soblossom_adjust_title_home
*/
require get_template_directory() . '/inc/soblossom.php';
/**
* inc/iconfont-walker.php - Custom Walker to enable using Font Awesome icon font in navigation menus
* - used for social media menu
*
* comment out to exclude
*/
require get_template_directory() . '/inc/walkers/iconfont-walker.php';
/**
* /inc/classes/Mobile_Detect.php - Mobile Detect Library
* - used for tplparts/nav-topbar.php among others
*
* @link: mobiledetect.net
* comment out to exclude
*/
//require get_template_directory() . '/inc/classes/Mobile_Detect.php';
//$soblossom_detect = new Mobile_Detect();
/**
* /inc/classes/gallery.php - soblossom_clearing_blockgrid_gallery
* adapted the output of the WP Gallery shortcode
*
* comment out to exclude
*/
require get_template_directory() . '/inc/classes/gallery.php';
/**
* /inc/classes/aq_resizer.php - Aqua Resizer script to dynamically resize images
*
* @link: github.com/syamilmj/Aqua-Resizer
* uncomment to include
*/
//require get_template_directory() . '/inc/classes/aq_resizer.php';
/**
* /inc/functions/functionality.php - your own functions file
* this file is for you to add your own functions, added with an eye on portability
* you can also add your own functions to this main functions.php file or any other place you like
*
* uncomment to include
*/
//require get_template_directory() . '/inc/functions/functionality.php';
/**
* /inc/functions/cpt.php - Custom Post Type registration file
* /inc/functions/cmb.php - Custom Meta Box registration file
*
* sample custom post type included, generated with generatewp.com/post-type/; generate custom taxonomies with generatewp.com/taxonomy/
* sample custom meta box included, generated from github.com/rilwis/meta-box/blob/master/demo/demo.php
*
* uncomment to include
*/
//require get_template_directory() . '/inc/functions/cpt.php';
//require get_template_directory() . '/inc/functions/cmb.php';
/**
* /inc/functions/dashboard-functions.php - specific backend functions
* - change howdy into something more appropriate
* - change dashboard footer
* - remove number of default dashboard widgets
* - remove number of default WordPress widgets
* - custom login
* - always remove adminbar from frontend
* - remove 3 custom columns added by Yoast WordPress SEO plugin
*
* uncomment to include
*/
//require get_template_directory() . '/inc/functions/dashboard-functions.php';
/**
* NAVIGATION MENUS FUNCTIONS
*
* Top Navigation and Footer Navigation Menus
* Registration of the menus takes place in soblossom_setup in inc/soblossom.php
*/
// topnav-menu
function soblossom_top_nav() {
wp_nav_menu( array(
'container' => false,
'container_class' => '',
'menu' => __( 'Top Navigation', 'soblossom-backend' ),
'menu_class' => 'right',
'theme_location' => 'topnav',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'fallback_cb' => 'soblossom_topnav_fallback', // workaround to show a message to set up a menu (copied from required)
));
} /* end soblossom_top_nav */
// social-media-menu (optional)
function soblossom_social_media_links() {
wp_nav_menu( array(
'container' => '',
'container_class' => 'socialmedia clearfix',
'menu' => __( 'Social Media', 'soblossom-backend' ),
'menu_class' => 'social-links',
'theme_location' => 'social',
'depth' => '1',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'walker' => new iconfont_walker(), // custom walker located in inc/walkers/iconfont-walker.php - add social media name to description
'fallback_cb' => 'soblossom_socialmedia_fallback' // workaround to show a message to set up a menu (copied from required)
));
} /* end soblossom_social_media_links */
// footer-menu (optional)
function soblossom_footer_nav() {
wp_nav_menu( array(
'container' => false,
'container_class' => '',
'menu' => __( 'Footer Links', 'soblossom-backend' ),
'menu_class' => 'footer-nav inline-list right',
'theme_location' => 'footer',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'depth' => 0,
'fallback_cb' => 'soblossom_footer_fallback', // workaround to show a message to set up a menu (copied from required)
));
} /* end soblossom_footer_nav */
/**
* A fallback when no navigation is selected by default, otherwise it throws some nasty errors.
* From required+ Foundation http://themes.required.ch
*/
if( ! function_exists( 'soblossom_topnav_fallback' ) ) {
function soblossom_topnav_fallback() {
echo '<div class="alert-box warning">';
// Translators 1: Link to Menus, 2: Link to Customize
printf( __( 'Add your Top Navigation Menu by adding a %1$s or %2$s the design.', 'soblossom-backend' ),
sprintf( __( '<a href="%s">Menu</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'nav-menus.php' )
),
sprintf( __( '<a href="%s">Customizing</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'customize.php' )
)
);
echo '</div>';
}
}
if( ! function_exists( 'soblossom_socialmedia_fallback' ) ) {
function soblossom_socialmedia_fallback() {
echo '<div class="alert-box info">';
// Translators 1: Link to Menus, 2: Link to Customize
printf( __( 'Add a %1$s and use FontAwesome names for the descriptions to show your own Social Links. Alternatively use the %2$s.', 'soblossom-backend' ),
sprintf( __( '<a href="%s">Social Media menu</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'nav-menus.php' )
),
sprintf( __( '<a href="%s">Customizer</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'customize.php' )
)
);
echo '</div>';
}
}
if( ! function_exists( 'soblossom_footer_fallback' ) ) {
function soblossom_footer_fallback() {
echo '<div class="alert-box alert">';
// Translators 1: Link to Menus, 2: Link to Customize
printf( __( 'Add your own Footer Links by adding a %1$s or %2$s the design.', 'soblossom-backend' ),
sprintf( __( '<a href="%s">Menu</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'nav-menus.php' )
),
sprintf( __( '<a href="%s">Customizing</a>', 'soblossom-backend' ),
get_admin_url( get_current_blog_id(), 'customize.php' )
)
);
echo '</div>';
}
}
/**
* WIDGET AREAS FUNCTIONS
*
* Sidebars & Widgetised Areas
* Registration of the areas takes place in soblossom_setup in inc/soblossom.php
*/
function soblossom_register_widget_areas() {
register_sidebar( array(
'name' => __( 'Sidebar Widget Area', 'soblossom-backend' ),
'id' => 'sidebar-widget-area',
'description' => __( 'Appears on the side (right by default) of the site.', 'soblossom-backend' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer Widget Area', 'soblossom-backend' ),
'id' => 'footer-widget-area',
'description' => __( 'Appears in the footer section of the site.', 'soblossom-backend' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s small-12 medium-3 columns">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}