This repository has been archived by the owner on Oct 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfunctions.php
441 lines (359 loc) · 13.5 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<?php
/**
* MyFirstTheme's functions and definitions
*
* @package LiveFACE_Portfolio
* @since LiveFACE_Portfolio 1.2
*/
/**
*
* Functions used to generate post excerpt
*
* @return HTML output
*
**/
//Load Main CSS
function liveface_load_styles() {
// Add Common css.
wp_enqueue_style( 'style', get_stylesheet_uri(), '1.5.5' );
// Add Index css.
wp_enqueue_style('liveface-css-index', get_template_directory_uri() . '/asset/css/index.css', false, '1.6.3');
// Add Animate css
wp_enqueue_style('liveface-css-animate', get_template_directory_uri() . '/asset/css/animate.css', false, '1.6.3');
// Add Video css
wp_enqueue_style('liveface-css-video', get_template_directory_uri() . '/asset/css/video.css', false, '1.6.3');
// Add Font-awesome css
wp_enqueue_style('liveface-css-font-awesome', get_template_directory_uri() . '/asset/css/font-awesome.min.css', false, '1.1');
}
add_action( 'wp_enqueue_scripts', 'liveface_load_styles' );
function liveface_post_load_styles(){
if(is_singular('post') || is_singular('page')){
// Add Post css
wp_enqueue_style('liveface-css-post', get_template_directory_uri() . '/asset/css/post.css', false, '2.2.7');
// Add Common css.
wp_enqueue_style( 'style', get_stylesheet_uri() );
// Add Font-awesome css
wp_enqueue_style('liveface-css-font-awesome', get_template_directory_uri() . '/asset/css/font-awesome.min.css', false, '1.0');
}
}
add_action( 'wp_enqueue_scripts', 'liveface_post_load_styles' );
//Register Menu
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );
//Remove Amin Topbar
function remove_admin_login_header() {
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('get_header', 'remove_admin_login_header');
//Add Featured Image support
add_theme_support('post-thumbnails');
the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)
the_post_thumbnail('full'); // Original image resolution (unmodified)
add_image_size('featuredImageCropped', 1920, 1080, true);
the_post_thumbnail('featuredImageCropped');
//Theme Custom Settings{
function devework_cancel_open_sans() {
wp_deregister_style('open-sans');
/*
//Use 360 CDN
wp_register_style( 'open-sans', '//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600' );
wp_enqueue_style( 'open-sans');*/
}
//add_action( 'wp_enqueue_scripts', 'devework_cancle_open_sans' );
function liveface_customize_register( $wp_customize ) {
$wp_customize->remove_section( 'custom_css' );
$wp_customize->remove_section( 'static_front_page' );
//Background Video Start
$wp_customize->add_section('bg_image', array(
'title' => 'Background Image',
'description' => 'Add a background image to home page. Require a 3840x2160 image. Recommend to compress your image by using TinyPNG.com ',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('bg_image', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
//Background Video Upload
$wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'bg_image', array(
'section' => 'bg_image',
'label' => 'Background Image. 3840x2160',
'mime_type' => 'audio'
)));
//Background Video Start
$wp_customize->add_section('bg_video', array(
'title' => 'Intro Video',
'description' => 'Add a self Intro video to home page. For other source link, leave it blank if you do not want to display.',
'capability' => 'edit_theme_options'
));
//Background Video Setting
$wp_customize->add_setting('bg_video', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
//Background Video Upload
$wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'bg_video', array(
'section' => 'bg_video',
'label' => 'Background Video',
'mime_type' => 'audio'
)));
//Background Video Youtube Link Setting
$wp_customize->add_setting('youtube_link', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
));
//Background Video Youtube Link Input Box
$wp_customize->add_control('youtube_link', array(
'label' => __('Youtube URL', 'LiveFACE'),
'section' => 'bg_video',
'priority' => 15,
'settings' => 'youtube_link'
));
//Background Video Tentcent Video Link Setting
$wp_customize->add_setting('tencent_video_link', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
));
//Background Video Tentcent Video Link Input Box
$wp_customize->add_control('tencent_video_link', array(
'label' => __('Tencent Video', 'LiveFACE'),
'section' => 'bg_video',
'priority' => 15,
'settings' => 'tencent_video_link'
));
//Profile Picture Start
$wp_customize->add_section('bg_profilePic', array(
'title' => 'Profile Picture',
'description' => 'Your profile picture',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('bg_profilePic', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));
$wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'bg_profilePic', array(
'section' => 'bg_profilePic',
'label' => 'Make sure Image Height = Width',
'mime_type' => 'audio'
)));
//Big Index Text Start
$wp_customize->add_section('bg_bigText', array(
'title' => 'I AM Name',
'description' => 'Add your name to the font page',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('bg_bigText_firstName', array(
'type' => 'theme_mod',
'default' => 'LiveFACE',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('bg_bigText_firstName', array(
'label' => __('First name', 'LiveFACE'),
'section' => 'bg_bigText',
'priority' => 15,
'settings' => 'bg_bigText_firstName'
));
$wp_customize->add_setting('bg_bigText_surName', array(
'type' => 'theme_mod',
'default' => 'Theme',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('bg_bigText_surName', array(
'label' => __('Last name', 'LiveFACE'),
'section' => 'bg_bigText',
'priority' => 15,
'settings' => 'bg_bigText_surName'
));
//Other Portfolio Settinga
$wp_customize->add_section('other_portfolio', array(
'title' => 'Other portfolio settings',
'description' => 'Add your name to the font page. Leave it blank if you do not want to display.',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('op_instagram', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_instagram', array(
'label' => __('Instagram', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_instagram'
));
$wp_customize->add_setting('op_pinterest', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_pinterest', array(
'label' => __('Pinterest', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_pinterest'
));
$wp_customize->add_setting('op_behance', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_behance', array(
'label' => __('Behance', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_behance'
));
$wp_customize->add_setting('op_dribbble', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_dribbble', array(
'label' => __('Dribbble', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_dribbble'
));
$wp_customize->add_setting('op_github', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_github', array(
'label' => __('Github', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_github'
));
$wp_customize->add_setting('op_facebook', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_facebook', array(
'label' => __('Facebook', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_facebook'
));
$wp_customize->add_setting('op_twitter', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_twitter', array(
'label' => __('Twitter', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_twitter'
));
$wp_customize->add_setting('op_linkedin', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('op_linkedin', array(
'label' => __('LinkedIn', 'LiveFACE'),
'section' => 'other_portfolio',
'priority' => 15,
'settings' => 'op_linkedin'
));
$wp_customize->add_section('popup_alert', array(
'title' => 'Pop up Alert',
'description' => 'Set up your alert',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('popup_alert_text', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('popup_alert_text', array(
'label' => __('Pop up text', 'LiveFACE'),
'section' => 'popup_alert',
'priority' => 15,
'settings' => 'popup_alert_text'
));
$wp_customize->add_section('icp', array(
'title' => 'China Internet Content Provider Licenses',
'description' => 'Add your ICP number',
'capability' => 'edit_theme_options'
));
$wp_customize->add_setting('icp_settings', array(
'type' => 'theme_mod',
'default' => '#',
'capability' => 'edit_theme_options',
));
$wp_customize->add_control('icp', array(
'label' => __('ICP', 'LiveFACE'),
'section' => 'icp',
'priority' => 15,
'settings' => 'icp_settings'
));
}
add_action( 'customize_register', 'liveface_customize_register' );
//Like Function:
add_action('wp_ajax_nopriv_bigfa_like', 'bigfa_like');
add_action('wp_ajax_bigfa_like', 'bigfa_like');
function bigfa_like(){
global $wpdb,$post;
$id = $_POST["um_id"];
$action = $_POST["um_action"];
if ( $action == 'ding'){
$bigfa_raters = get_post_meta($id,'bigfa_ding',true);
$expire = time() + 99999999;
$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; // make cookies work with localhost
setcookie('bigfa_ding_'.$id,$id,$expire,'/',$domain,false);
if (!$bigfa_raters || !is_numeric($bigfa_raters)) {
update_post_meta($id, 'bigfa_ding', 1);
}
else {
update_post_meta($id, 'bigfa_ding', ($bigfa_raters + 1));
}
echo get_post_meta($id,'bigfa_ding',true);
}
die;
}
//Custom Image Size
function liveface_image_sizes($sizes) {
$addsizes = array(
"liveface-image-size" => __( "Liveface image", "liveface")
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
/**
* Display navigation to next/previous set of posts when applicable.
*
*
* @return void
*/
function liveface_paging_nav() {
global $wp_query, $paged;
//10 Article A page
//display number of current page
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 )
return;
?>
<div class='index_gallery_Contorller'>
<!--div class="nav-previous"><?php //next_posts_link( __( 'Older posts', 'portfolio' ) ); ?></div-->
<div class='gC gC_left'> <?php next_posts_link( __( '<i class="fa fa-angle-left" aria-hidden="true"></i> Older posts', 'liveface' ) ); ?></div>
<!--div class="nav-next"><?php //previous_posts_link( __( 'Newer posts', 'portfolio' ) ); ?></div-->
<div class='gC gC_right' ><?php previous_posts_link( __( 'Newer posts <i class="fa fa-angle-right" aria-hidden="true"></i>', 'liveface' ) ); ?> </div>
</div>
<?php
}
?>