-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
247 lines (192 loc) · 8.63 KB
/
functions.php
File metadata and controls
247 lines (192 loc) · 8.63 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
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
<?php
require_once( get_theme_file_path( "/inc/tgm.php" ) );
require_once( get_theme_file_path( "/inc/attachments.php" ) );
require_once( get_theme_file_path( "/widgets/social-icons-widget.php" ) );
if ( ! isset( $content_width ) ) {
$content_width = 960;
}
if ( site_url() == "http://demo.lwhh.com" ) {
define( "VERSION", time() );
} else {
define( "VERSION", wp_get_theme()->get( "Version" ) );
}
function philosophy_theme_setup() {
load_theme_textdomain( "philosophy" );
add_theme_support( "post-thumbnails" );
add_theme_support( "custom-logo" );
add_theme_support( "title-tag" );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'html5', array( 'search-form', 'comment-list' ) );
add_theme_support( "post-formats", array( "image", "gallery", "quote", "audio", "video", "link" ) );
add_editor_style( "/assets/css/editor-style.css" );
register_nav_menu( "topmenu", __( "Top Menu", "philosophy" ) );
register_nav_menus( array(
"footer-left" => __( "Footer Left Menu", "philosophy" ),
"footer-middle" => __( "Footer Middle Menu", "philosophy" ),
"footer-right" => __( "Footer Right Menu", "philosophy" ),
) );
add_image_size( "philosophy-home-square", 400, 400, true );
}
add_action( "after_setup_theme", "philosophy_theme_setup" );
function philosophy_assets() {
wp_enqueue_style( "fontawesome-css", get_theme_file_uri( "/assets/css/font-awesome/css/font-awesome.css" ), null, "1.0" );
wp_enqueue_style( "fonts-css", get_theme_file_uri( "/assets/css/fonts.css" ), null, "1.0" );
wp_enqueue_style( "base-css", get_theme_file_uri( "/assets/css/base.css" ), null, "1.0" );
wp_enqueue_style( "vendor-css", get_theme_file_uri( "/assets/css/vendor.css" ), null, "1.0" );
wp_enqueue_style( "main-css", get_theme_file_uri( "/assets/css/main.css" ), null, "1.0" );
wp_enqueue_style( "philosophy-css", get_stylesheet_uri(), null, VERSION );
wp_enqueue_script( "modernizr-js", get_theme_file_uri( "/assets/js/modernizr.js" ), null, "1.0" );
wp_enqueue_script( "pace-js", get_theme_file_uri( "/assets/js/pace.min.js" ), null, "1.0" );
wp_enqueue_script( "plugins-js", get_theme_file_uri( "/assets/js/plugins.js" ), array( "jquery" ), "1.0", true );
if ( is_singular() ) {
wp_enqueue_script( "comment-reply" );
}
wp_enqueue_script( "main-js", get_theme_file_uri( "/assets/js/main.js" ), array( "jquery" ), "1.0", true );
}
add_action( "wp_enqueue_scripts", "philosophy_assets" );
function philosophy_pagination() {
global $wp_query;
$links = paginate_links( array(
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'mid_size' => apply_filters( "philosophy_pagination_mid_size", 3 )
) );
$links = str_replace( "page-numbers", "pgn__num", $links );
$links = str_replace( "<ul class='pgn__num'>", "<ul>", $links );
$links = str_replace( "next pgn__num", "pgn__next", $links );
$links = str_replace( "prev pgn__num", "pgn__prev", $links );
echo wp_kses_post( $links );
}
remove_action( "term_description", "wpautop" );
function philosophy_widgets() {
register_sidebar( array(
'name' => __( 'About Us Page', 'philosophy' ),
'id' => 'about-us',
'description' => __( 'Widgets in this area will be shown on about us page.', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="col-block %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="quarter-top-margin">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Contact Page Maps Section', 'philosophy' ),
'id' => 'contact-maps',
'description' => __( 'Widgets in this area will be shown on contact page.', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __( 'Contact Page Information Section', 'philosophy' ),
'id' => 'contact-info',
'description' => __( 'Widgets in this area will be shown on contact page.', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="col-block %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="quarter-top-margin">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Before Footer Section', 'philosophy' ),
'id' => 'before-footer-right',
'description' => __( 'before footer section, right side', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer Section', 'philosophy' ),
'id' => 'footer-right',
'description' => __( 'footer section, right side', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => __( 'Footer Bottom Section', 'philosophy' ),
'id' => 'footer-bottom',
'description' => __( 'footer section, bottom side', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __( 'Header Section', 'philosophy' ),
'id' => 'header-section',
'description' => __( 'Widgets in this area will be shown on header section.', 'philosophy' ),
'before_widget' => '<div id="%1$s" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( "widgets_init", "philosophy_widgets" );
function category_before_title1() {
echo "<p>Before Title 1</p>";
}
add_action( "philosphy_before_category_title", "category_before_title1" );
function category_before_title2() {
echo "<p>Before Title 2</p>";
}
add_action( "philosphy_before_category_title", "category_before_title2", 4 );
function category_before_title3() {
echo "<p>Before Title 3</p>";
}
add_action( "philosphy_before_category_title", "category_before_title3", 9 );
function category_after_title() {
echo "<p>After Title</p>";
}
add_action( "philosphy_after_category_title", "category_after_title" );
remove_action("philosphy_before_category_title", "category_before_title1");
remove_action("philosphy_before_category_title", "category_before_title2",4);
remove_action("philosphy_before_category_title", "category_before_title3",9);
function category_after_desc() {
echo "<p>After Description</p>";
}
add_action( "philosphy_after_category_description", "category_after_desc" );
function beginning_category_page( $category_title ) {
if ( "New" == $category_title ) {
$visit_count = get_option( "category_new" );
$visit_count = $visit_count ? $visit_count : 0;
$visit_count ++;
update_option( "category_new", $visit_count );
}
}
add_action( "philosphy_category_page", "beginning_category_page" );
function philosophy_home_banner_class( $class_name ) {
if ( is_home() ) {
return $class_name;
} else {
return "";
}
}
add_filter( "philosophy_home_banner_class", "philosophy_home_banner_class" );
function pagination_mid_size( $size ) {
return 2;
}
add_filter( "philosophy_pagination_mid_size", "pagination_mid_size" );
function uppercase_text( $param1, $param2, $param3 ) {
return ucwords( $param1 ) . " " . strtoupper( $param2 ) . " " . ucwords( $param3 );
}
add_filter( "philosophy_text", "uppercase_text", 10, 3 );
function philosophy_search_form( $form ) {
$homedir = home_url( "/" );
$label = __( "Search for:", "philosophy" );
$button_label = __( "Search", "philosophy" );
$newform = <<<FORM
<form role="search" method="get" class="header__search-form" action="{$homedir}">
<label>
<span class="hide-content">{$label}</span>
<input type="search" class="search-field" placeholder="Type Keywords" value="" name="s"
title="{$label}" autocomplete="off">
</label>
<input type="submit" class="search-submit" value="{$button_label}">
</form>
FORM;
return $newform;
}
add_filter( "get_search_form", "philosophy_search_form" );