-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
82 lines (61 loc) · 2.06 KB
/
functions.php
File metadata and controls
82 lines (61 loc) · 2.06 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
<?php
// ensures [shortcodes] work in text widgets
add_filter( 'widget_text', 'do_shortcode' );
/**
* Loads main MD stylesheet + your custom stylesheet.
*
* @since 1.0
*/
function md_child_theme_enqueue_style() {
wp_enqueue_style( 'marketers-delight', MD_URL . 'style.css' );
wp_enqueue_style( 'md-child-theme', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'md_child_theme_enqueue_style' );
/**
* Add MD meta options to any Custom Post Type.
* Uncomment add_filter() and set proper IDs for your post type(s).
* Read more: https://kolakube.com/guides/metaboxes-custom-post-types-taxonomies/
*
* @since 1.1
*/
function md_add_post_type_meta() {
return array( 'download', 'product' );
}
//add_filter( 'md_post_type_meta', 'md_add_post_type_meta' );
/**
* Add MD meta options to any Custom Taxonomy.
* Uncomment add_filter() and set proper IDs for your taxonomies.
* Read more: https://kolakube.com/guides/metaboxes-custom-post-types-taxonomies/
*
* @since 1.1
*/
function md_add_taxonomy_meta() {
return array( 'download_category', 'product_cat' );
}
//add_filter( 'md_taxonomy_meta', 'md_add_taxonomy_meta' );
function get_this_year() {
return date('Y');
}
add_shortcode( 'this_year', 'get_this_year' );
function linux_uptime() {
$ut = strtok( exec( 'cat /proc/uptime' ), '.' );
$days = sprintf( '%2d', ($ut/(3600*24)) );
$hours = sprintf( '%2d', ( ($ut % (3600*24)) / 3600) );
$min = sprintf( '%2d', ($ut % (3600*24) % 3600)/60 );
$sec = sprintf( '%2d', ($ut % (3600*24) % 3600)%60 );
$ut = array( $days, $hours, $min, $sec );
return 'Server Uptime: ' . $ut[0] . ' days, ' . $ut[1] . ' hours, ' . $ut[2] . ' minutes ' . $ut[3] . ' seconds.';
}
add_shortcode( 'uptime', 'linux_uptime' );
/**
* Custom code starts here
* Below are my own code not Kolakube
*/
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
function toc_shortcode( $atts, $content = null ) {
if (!is_front_page()) {
return '<div>' . $content . '</div>';
}
}
add_shortcode( 'toc', 'toc_shortcode' );