-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
184 lines (108 loc) · 5.27 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
<?php
// Include Beans
require_once( get_template_directory() . '/lib/init.php' );
// Remove Beans Default Styling
remove_theme_support( 'beans-default-styling' );
// Enqueue uikit assets
beans_add_smart_action( 'beans_uikit_enqueue_scripts', 'jenkins_enqueue_uikit_assets', 5 );
function jenkins_enqueue_uikit_assets() {
// Enqueue uikit overwrite theme folder
beans_uikit_enqueue_theme( 'jenkins', get_stylesheet_directory_uri() . '/assets/less/uikit' );
// Add the theme style as a uikit fragment to have access to all the variables
beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/assets/less/style.less', 'less' );
}
// Remove page post type comment support
beans_add_smart_action( 'init', 'jenkins_post_type_support' );
function jenkins_post_type_support() {
remove_post_type_support( 'page', 'comments' );
}
// Setup document fragements, markups and attributes
beans_add_smart_action( 'wp', 'jenkins_setup_document' );
function jenkins_setup_document() {
// Header
beans_add_attribute( 'beans_site_branding', 'class', 'uk-margin-small-top' );
// Breadcrumb
beans_remove_action( 'beans_breadcrumb' );
// Navigation
beans_add_attribute( 'beans_sub_menu_wrap', 'class', 'uk-dropdown-center' );
beans_remove_attribute( 'beans_menu_item_child_indicator', 'class', 'uk-margin-small-left' );
// Post content
beans_add_attribute( 'beans_post_content', 'class', 'uk-text-large' );
// Post image
beans_add_attribute( 'beans_post_image', 'class', 'tm-cover-article' );
// Post meta
beans_remove_attribute( 'beans_post_meta', 'class', 'uk-subnav-line' );
beans_remove_action( 'beans_post_meta_tags' );
beans_remove_action( 'beans_post_meta_categories' );
beans_remove_output( 'beans_post_meta_categories_prefix' );
// Post embed
beans_add_attribute( 'beans_embed_oembed', 'class', 'tm-cover-article' );
// Comment meta
beans_modify_action_priority( 'beans_comment_metadata', 9 );
// Comment form
beans_add_attribute( 'beans_comment_form_wrap', 'class', 'tm-cover-article' );
beans_add_attribute( 'beans_comment_fields_inner_wrap', 'class', 'uk-grid-small' );
beans_add_attribute( 'beans_comment_form_submit', 'class', 'uk-button-large' );
if ( !is_user_logged_in() )
beans_replace_attribute( 'beans_comment_form_comment', 'class', 'uk-width-medium-1-1', 'uk-width-medium-6-10' );
// Search
if ( is_search() )
beans_remove_action( 'beans_post_image' );
}
// Modify beans layout (filter)
beans_add_smart_action( 'beans_layout_grid_settings', 'jenkins_layout_grid_settings' );
function jenkins_layout_grid_settings( $layouts ) {
return array_merge( $layouts, array(
'grid' => 10,
'sidebar_primary' => 3,
'sidebar_secondary' => 3,
) );
}
// Modify beans post meta items (filter)
beans_add_smart_action( 'beans_post_meta_items', 'jenkins_post_meta_items' );
function jenkins_post_meta_items( $items ) {
// Remove author meta
unset( $items['author'] );
// Add categories meta
$items['categories'] = 20;
return $items;
}
// Add post meta item date icon
beans_add_smart_action( 'beans_post_meta_item_date_prepend_markup', 'jenkins_post_meta_item_date_icon' );
function jenkins_post_meta_item_date_icon() {
echo beans_open_markup( 'jenkins_post_meta_item_date_icon', 'i', 'class=uk-icon-clock-o uk-margin-small-right uk-text-muted' );
echo beans_close_markup( 'jenkins_post_meta_item_date_icon', 'i' );
}
// Add post meta item author icon
beans_add_smart_action( 'beans_post_meta_item_categories_prepend_markup', 'jenkins_post_meta_item_categories_icon' );
function jenkins_post_meta_item_categories_icon() {
echo beans_open_markup( 'jenkins_post_meta_item_categories_icon', 'i', 'class=uk-icon-archive uk-margin-small-right uk-text-muted' );
echo beans_close_markup( 'jenkins_post_meta_item_categories_icon', 'i' );
}
// Add post meta item comment icon
beans_add_smart_action( 'beans_post_meta_item_comments_prepend_markup', 'jenkins_post_meta_item_comments_icon' );
function jenkins_post_meta_item_comments_icon() {
echo beans_open_markup( 'jenkins_post_meta_item_comments_icon', 'i', 'class=uk-icon-comments uk-margin-small-right uk-text-muted' );
echo beans_close_markup( 'jenkins_post_meta_item_comments_icon', 'i' );
}
// Remove comment after note (filter)
beans_add_smart_action( 'comment_form_defaults', 'jenkins_comment_form_defaults' );
function jenkins_comment_form_defaults( $args ) {
$args['comment_notes_after'] = '';
return $args;
}
// Add avatar uikit circle class (filter)
beans_add_smart_action( 'get_avatar', 'jenkins_avatar' );
function jenkins_avatar( $output ) {
return str_replace( "class='avatar", "class='avatar uk-border-circle", $output ) ;
}
// Modify the tags cloud widget
beans_add_smart_action( 'wp_generate_tag_cloud', 'jenkins_widget_tags_cloud' );
function jenkins_widget_tags_cloud( $output ) {
return preg_replace( "#style='font-size:.+pt;'#", '', $output );
}
// Add footer content (filter)
beans_add_smart_action( 'beans_footer_credit_right_text_output', 'jenkins_footer' );
function jenkins_footer() { ?>
<a href="http://www.themebutler.com/themes/jenkins/" target="_blank" title="Jenkins theme for WordPress">Jenkins</a> theme for <a href="http://wordpress.org" target="_blank">WordPress</a>. Built-with <a href="http://www.getbeans.io/" title="Beans Framework for WordPress" target="_blank">Beans</a>.
<?php }