/
functions.php
754 lines (636 loc) · 26.9 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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<?php
include_once( 'library/pagination.php' ); //Pagination functions library
require('ar-teks/ar-teks.php');
add_action( 'after_setup_theme', 'initial_setup' );
if ( ! function_exists( 'initial_setup' ) ) {
function initial_setup() {
// Add default posts and comments RSS feed links to <head>.
add_theme_support('automatic-feed-links');
// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
add_theme_support('post-thumbnails');
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
//set_post_thumbnail_size(80, 80, true);
add_image_size( 'featured', 640, 250, true);
add_image_size( 'header-image', 1366, 800);
//add_image_size( 'attachment', 1000, 750);
//add_image_size( 'thumb-mini', 60, 60, true);
//add_theme_support( 'custom-background' );
}
}
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'footer-menu' => __( 'Footer Menu' )
)
);
}
add_action( 'init', 'register_my_menus' );
/**
* Create a nicely formatted and more specific title element text for output
* in head of document, based on current view.
*
*/
function galausehat_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() ) {
return $title;
}
// Add the site name.
$title .= get_bloginfo( 'name', 'display' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description";
}
// Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'galausehat' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'galausehat_wp_title', 10, 2 );
/**
* Enqueue scripts and styles for the front end.
*
*/
function galausehat_scripts() {
// Load our main stylesheet.
wp_enqueue_style( 'galausehat-style', get_stylesheet_uri(), false, null);
wp_deregister_script('jquery');
wp_enqueue_script('jquery', get_template_directory_uri() . '/bower_components/jquery/dist/jquery.min.js', false, null, true);
wp_enqueue_script( 'galausehat-bootstrap', get_template_directory_uri() . '/bower_components/bootstrap/dist/js/bootstrap.min.js', array( 'jquery' ), null, true );
wp_enqueue_script( 'galausehat-headroom', get_template_directory_uri() . '/js/headroom.min.js', array( 'jquery' ), null, true );
wp_enqueue_script( 'galausehat-headroom-jquery', get_template_directory_uri() . '/js/jquery.headroom.min.js', array( 'galausehat-headroom' ), null, true );
//if ( is_home() || is_search() || is_author() || is_archive() ) {
wp_enqueue_script( 'galausehat-infinite-scroll', get_template_directory_uri() . '/js/min/infinite-scroll-min.js', array( 'jquery' ), null, true );
//}
wp_enqueue_script( 'galausehat-script', get_template_directory_uri() . '/js/min/all-min.js', array( 'jquery' ), null, true );
}
add_action( 'wp_enqueue_scripts', 'galausehat_scripts' );
/**
* infinite scroll.
*
*/
function galausehat_jetpack_setup() {
add_theme_support( 'infinite-scroll', array(
'type' => 'scroll',
'container' => 'posto',
'wrapper' => true,
'render' => 'galausehat_popular_infinite_scroll_render',
) );
}
add_action( 'after_setup_theme', 'galausehat_jetpack_setup' );
function galausehat_custom_infinite_more() {
if ( is_home() || is_archive() ) {
?>
<script type="text/javascript">
infiniteScroll.settings.text = "Artikel Lainnya";
</script>
<?php }
}
add_action( 'wp_footer', 'galausehat_custom_infinite_more', 10 );
function galausehat_popular_infinite_scroll_render() {
// start - guna default dulu, sbb custom popular tak jadi.
if ( have_posts() ) :
while ( have_posts() ): the_post();
$url = catch_post_image(true, $post->ID, $post->post_content);
$ctgr = get_the_category($post->ID);
?>
<div class="grid col-md-4 col-sm-6">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="holder">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h2>', '</h2>' ); ?>
<div class="meta">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = $ctgr[0]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
<?php
endwhile; ?>
<?php endif;
?>
<?php wp_reset_postdata();
// end
}
/**
* Get gravatar url
*
*/
function get_gravatar_url( $email, $dimension ) {
$hash = md5( strtolower( trim ( $email ) ) );
return 'http://gravatar.com/avatar/' . $hash . '?s=' .$dimension;
}
/**
* Modify Read More text
*
*/
function galausehat_modify_read_more_link() {
return '...';
}
add_filter( 'the_content_more_link', 'galausehat_modify_read_more_link' );
/**
* Modify Exceprt Read More text
*
*/
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
/**
* Modify Excerpt Length
*
*/
function custom_excerpt_length( $length ) {
return 24;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
/**
* Estimate time required to read the article
*
*/
function galausehat_estimated_reading_time( $wpm = 120 ) {
global $post;
$content = strip_tags($post->post_content);
$content_words = str_word_count($content);
$estimated_minutes = floor($content_words / $wpm);
$result = '';
if ($estimated_minutes < 1)
$result .= " ".__('Kurang seminit pembacaan', 'galausehat');
else if ($estimated_minutes > 60) {
if ($estimated_minutes > 1440)
$result .= " ".__('Lebih dari sehari pembacaan', 'galausehat');
else
$result .= floor($estimated_minutes / 60)." ". __('jam pembacaan', 'galausehat');
}
else if ($estimated_minutes == 1)
$result .= $estimated_minutes." ". __('minit pembacaan', 'galausehat');
else
$result .= $estimated_minutes." ". __('minit pembacaan', 'galausehat');
return $result;
}
/**
* Add img-responsive class to image in content
*
*/
function galausehat_add_image_responsive_class($content) {
global $post;
$pattern ="/<img(.*?)class=\"(.*?)\"(.*?)>/i";
$replacement = '<img$1class="$2 img-responsive"$3>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
add_filter('the_content', 'galausehat_add_image_responsive_class');
/**
* Add extra social fields to user profile
*
*/
function galausehat_add_contactmethod( $contactmethods ) {
// Add Twitter
$contactmethods['twitter'] = 'Twitter';
// Add Facebook
$contactmethods['facebook'] = 'Facebook';
// Add Instagram
$contactmethods['instagram'] = 'Instagram';
// Remove Yahoo IM
unset($contactmethods['yim']);
unset($contactmethods['aim']);
return $contactmethods;
}
add_filter('user_contactmethods','galausehat_add_contactmethod',10,1);
/**
* Related Posts
*
*/
function galausehat_related_posts( $post_id, $count=6 ){
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
// get tags from current post
$tags = wp_get_post_tags($post_id);
foreach($tags as $tag_item) {
$tag_array_name_list[] = $tag_item->slug;
}
if (empty($related_post)) {
$query = array (
'posts_per_page' => $count,
'post_type' => 'post',
'tag_slug__in' => $tag_array_name_list,
'post__not_in' => array ($post_id),
'ignore_sticky_posts' => true,
'paged' => $paged
);
$related_post = new WP_Query($query);
// if no related posts
if(!$related_post->have_posts()){
$query = array (
'posts_per_page' => $count,
'post_type' => 'post',
'post__not_in' => array ($post_id),
'ignore_sticky_posts' => true,
'paged' => $paged
);
$related_post = new WP_Query($query);
echo('no related');
}
if($related_post->have_posts()):
while($related_post->have_posts()) : $related_post->the_post();
$url = catch_post_image(true, $post->ID, $post->post_content);
$ctgr = get_the_category($post->ID);
?>
<div class="grid col-md-4 col-sm-6">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="holder">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h2>', '</h2>' ); ?>
<div class="meta">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = $ctgr[0]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
<?php
endwhile;
endif;
wp_reset_postdata();
}
}
// not call - original post - removed post count - use default wp setting.
function galausehat_author_all_posts($author_id, $pos = 'all') {
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
if ($pos == 'terkini') :
$query = array(
'author' => $author_id,
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'paged' => $paged
);
elseif ($pos == 'popular') :
$time = 'all';
$query = array(
'author' => $author_id,
'post_type' => 'post',
'meta_key' => '_count-views_'.$time,
'orderby' => 'meta_value_num',
'ignore_sticky_posts' => true,
'paged' => $paged
);
else :
$query = array(
'author' => $author_id,
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'paged' => $paged
);
endif;
$allpost = new WP_Query( $query );
if ( $allpost->have_posts() ) :
while ( $allpost->have_posts() ): $allpost->the_post();
$url = catch_post_image(true, $post->ID, $post->post_content);
$ctgr = get_the_category($post->ID);
?>
<div class="grid col-md-4 col-sm-6">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="holder">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h2>', '</h2>' ); ?>
<div class="meta">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = $ctgr[0]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
<?php
endwhile;
endif;
wp_reset_postdata();
}
/**
* Featured Posts
*
*/
function galausehat_featured_posts() {
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
$query = array(
'posts_per_page' => 3,
'post_type' => 'post',
'category_name' => 'featured',
'ignore_sticky_posts' => true
);
$featured = new WP_Query( $query );
$count = 1;
if ( $featured->have_posts() ) :
while ( $featured->have_posts() ): $featured->the_post();
//$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'featured' );
$url = catch_post_image(true, $post->ID, $post->post_content, 'featured');
$ctgr = get_the_category($post->ID);
if ($count == 1) :
?>
<div class="grid col-md-12 col-sm-12">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="featured">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h1>', '</h1>' ); ?>
<div class="meta pb-20">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = get_the_category(); $ctgr = $ctgr[1]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
<?php
else :
?>
<div class="grid col-md-6 col-sm-6">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="holder">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h2>', '</h2>' ); ?>
<div class="meta">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = $ctgr[1]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
<?php
endif;
$count += 1;
endwhile;
endif;
wp_reset_postdata();
}
// not call - original post - removed post count - use default wp setting. - Ahmad Rushdi
function galausehat_all_posts($pos = 'all') {
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
if ($pos == 'terkini') :
$query = array(
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'paged' => $paged
);
elseif ($pos == 'popular') :
$time = 'all';
$query = array(
'post_type' => 'post',
'meta_key' => '_count-views_'.$time,
'orderby' => 'meta_value_num',
'ignore_sticky_posts' => true,
'paged' => $paged
);
else :
$query = array(
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'paged' => $paged
);
endif;
$allpost = new WP_Query( $query );
if ( $allpost->have_posts() ) :
while ( $allpost->have_posts() ): $allpost->the_post();
$url = catch_post_image(true, $post->ID, $post->post_content);
$ctgr = get_the_category($post->ID);
?>
<div class="postscroll">
<div class="grid col-md-4 col-sm-6">
<article class="card">
<a href="<?php echo esc_url( get_permalink() ); ?>" class="holder">
<div class="cover" style="background-image: url(<?php echo $url; ?>);"></div>
<div class="caption">
<?php the_title( '<h2>', '</h2>' ); ?>
<div class="meta">
Oleh <?php the_author(); ?>
·
<?php echo get_the_date( get_option( 'date_format' ) ); ?>
</div>
</div>
</a>
<div class="category"><?php $ctgr = $ctgr[0]; echo '<a href="' . get_bloginfo('url') . '/category/' . $ctgr->category_nicename . '">'; echo $ctgr->cat_name; echo '</a>'; ?></div>
</article>
</div>
</div>
<?php
endwhile;
endif;
wp_reset_postdata();
}
/**
* Set Post's Featured Image as #belakang background-image
*
*/
function galausehat_set_header_image() {
global $post;
if ( is_single() ) :
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'featured' );
return $url = $thumb['0'];
else:
return;
endif;
}
/**
* Set Post view counts
*
*/
add_action('wp_ajax_view_count','view_count');
add_action('wp_ajax_nopriv_view_count','view_count');
function view_count($id) {
global $wpdb;
$postid = intval( $_POST['id'] );
$origin = $_SERVER['HTTP_ORIGIN'];
$domain = network_site_url();
//if ($origin==$domain) {
$timings = array( 'all'=>'', 'day'=>'Ymd', 'week'=>'YW', 'month'=>'Ym', 'year'=>'Y' );
$time_to_go = 0; // Default: no time between count
if( (int)$time_to_go == 0 ) {
foreach( $timings as $time=>$date )
{
if( $time != 'all' ) {
$date = '-' . date( $date );
}
// Filtered meta key name
//$meta_key_filtered = apply_filters( 'baw_count_views_meta_key', '_count-views_' . $time . $date, $time, $date );
$meta_key = '_count-views_' . $time . $date;
$count = (int)get_post_meta( $postid, $meta_key, true );
$count = $count + 3;
update_post_meta( $postid, $meta_key, $count );
}
}
//}
print_r($_POST);
die();
}
/**
* Grab Post's featured image or image in content
*
*/
function catch_post_image( $return = false, $id = '', $content = '', $size = 'header-image' ) {
global $post;
if ($id=='') {
$id = get_the_ID();
}
if ($content=='') {
$content = $post->post_content;
}
if ( has_post_thumbnail($id) ) {
$post_thumbnail_id = get_post_thumbnail_id($id);
$img = wp_get_attachment_image_src( $post_thumbnail_id, $size );
if(!$return){
echo $img[0];
} else {
return $img[0];
}
} else {
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
if($output!=''){
if(!$return){
echo $matches[1][0];
} else {
return $matches[1][0];
}
} else {
if(!$return){
//echo get_template_directory_uri().'/images/small_steps/small_steps.png';
} else {
//return get_template_directory_uri().'/images/small_steps/small_steps.png';
}
}
}
}
/**
* Register custom post_type: Blog
*
*/
function create_post_type() {
register_post_type( 'blog',
array(
'labels' => array(
'name' => 'Blogs',
'singular_name' => 'Blog',
'all_items' => 'All Blogs',
'add_new' => 'Add new Blog',
'edit_item' => 'Edit Blog',
'new_item' => 'New Blog',
'view_item' => 'View Blog',
'search_items' => 'Search Blog',
'not_found' => 'No Blog found',
'not_found_in_trash' => 'No Blog found in Trash'
),
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'rewrite' => array('slug' => 'blog', 'with_front' => false),
'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'author'),
'taxonomies' => array('category', 'post_tag'),
)
);
}
add_action( 'init', 'create_post_type' );
/**
* Register Meta-Box-Class: Posts.
*
*/
if ( is_admin() ) {
//include the main class file
require_once("library/meta-box-class/my-meta-box-class.php");
$prefix = 'galausehat_';
// Add video meta
$config = array(
'id' => $prefix.'posts', // meta box id, unique per meta box
'title' => 'More Configurations', // meta box title
'pages' => array('post'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array(), // list of meta fields (can be added by field arrays)
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
'use_with_theme' => true // change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
);
/* Initiate your meta box */
$meta_video = new AT_Meta_Box($config);
$meta_video->addCheckbox($prefix.'post_header_enable',array('name'=> 'Enable Header Image') );
$meta_video->addColor($prefix.'post_title_color', array('name'=> 'Title Custom Color') );
$meta_video->addColor($prefix.'post_excerpt_color', array('name'=> 'Sub Title (Excerpt) Custom Color') );
$meta_video->Finish();
}
function header_post_title() {
global $wpdb;
if ( is_single() ) {
$meta = get_post_meta( get_the_ID() );
if ( $meta['galausehat_post_header_enable'][0] ) {
echo "\n\n<style>\n.single #header { min-height:100%; }\n";
echo ".single #belakang, .page #belakang { background-color: transparent; }\n";
if ( $meta['galausehat_post_title_color'][0]<>'#' ) {
echo ".header--post-title h1 { color:". $meta['galausehat_post_title_color'][0] ."; }\n";
} else {
echo ".header--post-title h1 { color: #ffffff; }\n";
}
if ( $meta['galausehat_post_excerpt_color'][0]<>'#' ) {
echo ".header--post-title p { color:". $meta['galausehat_post_excerpt_color'][0] ."; }\n";
} else {
echo ".header--post-title p { color: #ffffff; }\n";
}
echo ".entry-title { display:none; }\n";
echo "</style>\n\n";
}
}
}
add_action('wp_head', 'header_post_title');
function header_homepage_css() {
global $wpdb;
if ( is_home() && of_get_option('header_background_enable') ) {
echo "\n\n<style>\n";
echo ".home #header h1 { color:" . of_get_option('header_title_color') . "; }\n";
echo ".home #header h2 { color:" . of_get_option('header_tagline_color') . "; }\n";
echo ".home #header h3 { color:" . of_get_option('header_tagline_color') . "; }\n";
echo ".home #header .btn-nav { background-color:" . of_get_option('header_button_bg') . "; color:" . of_get_option('header_button_color') . "; border-color:" . of_get_option('header_button_border_color') . "; }\n";
echo ".home #header .btn-nav:hover { background-color:" . of_get_option('header_button_bg_hover') . "; color:" . of_get_option('header_button_color_hover') . "; }\n";
echo "</style>\n\n";
}
}
add_action('wp_head', 'header_homepage_css');
add_action('get_header', 'remove_admin_login_header');
function remove_admin_login_header() {
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_filter( 'infinite_scroll_credit', 'galausehat_filter_jetpack_credit' );
function galausehat_filter_jetpack_credit() {
return '<a href="http://GalauSehat.id/">GalauSehat.ID - Ide dan Inspirasi</a>';
}