admin.php ➔ disable_default_dashboard_widgets()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
// This file handles the admin area and functions - You can use this file to make changes to the dashboard.
3
4
/************* DASHBOARD WIDGETS *****************/
5
// Disable default dashboard widgets
6
function disable_default_dashboard_widgets()
7
{
8
9
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'core'); // Comments Widget
10
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');  // Incoming Links Widget
11
    remove_meta_box('dashboard_plugins', 'dashboard', 'core');         // Plugins Widget
12
    remove_meta_box('dashboard_quick_press', 'dashboard', 'core');     // Quick Press Widget
13
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');   // Recent Drafts Widget
14
    remove_meta_box('dashboard_primary', 'dashboard', 'core');
15
    remove_meta_box('dashboard_secondary', 'dashboard', 'core');
16
    remove_meta_box('yoast_db_widget', 'dashboard', 'normal'); // Yoast's SEO Plugin Widget
17
}
18
19
// removing the dashboard widgets
20
add_action('admin_menu', 'disable_default_dashboard_widgets');
21
22
/************* CUSTOMIZE ADMIN *******************/
23
24
// Custom Backend Footer
25
function podium_custom_admin_footer()
26
{
27
    $wp_v         = get_bloginfo('version');
28
    $w_copyrights = _x('<span id="footer-thankyou">Developed by <a href="http://amitt.co.il" target="_blank">Amit Tal</a></span>', 'podium');
29
    return '<span style="direction:lrt;">v' . $wp_v . ' | ' . $w_copyrights . '</span>';
30
}
31
32
// adding it to the admin area
33
add_filter('admin_footer_text', 'podium_custom_admin_footer');
34
35
//ADD featured image thumbnail to WordPress admin columns
36
37
add_filter('manage_posts_columns', 'tcb_add_post_thumbnail_column', 5);
38
add_filter('manage_pages_columns', 'tcb_add_post_thumbnail_column', 5);
39
40
/**
41
 * @param  $cols
42
 * @return mixed
43
 */
44
function tcb_add_post_thumbnail_column($cols)
45
{
46
    $cols['tcb_post_thumb'] = __('Main image');
47
    return $cols;
48
}
49
50
add_action('manage_posts_custom_column', 'tcb_display_post_thumbnail_column', 5, 2);
51
add_action('manage_pages_custom_column', 'tcb_display_post_thumbnail_column', 5, 2);
52
53
/**
54
 * @param $col
55
 * @param $id
56
 */
57
function tcb_display_post_thumbnail_column($col, $id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
{
59
60
    switch ($col) {
61
        case 'tcb_post_thumb':
62
63
            if (function_exists('the_post_thumbnail')) {
64
                echo the_post_thumbnail('thumbnail');
65
            } else {
66
                echo 'Not supported in theme';
67
            }
68
69
            break;
70
    }
71
72
}
73
74
// Allow svg upload in media
75
/**
76
 * @param  $mimes
77
 * @return mixed
78
 */
79
function cc_mime_types($mimes)
80
{
81
    $mimes['svg']  = 'image/svg+xml';
82
    $mimes['svgz'] = 'image/svg+xml';
83
    return $mimes;
84
}
85
86
add_filter('upload_mimes', 'cc_mime_types');
87
88
89
// Set interval beween heartbewats
90
/**
91
 * @param  $settings
92
 * @return mixed
93
 */
94
function podium_heartbeat_settings($settings)
95
{
96
    $settings['interval'] = 60; //Anything between 15-60
97
    return $settings;
98
}
99
100
add_filter('heartbeat_settings', 'podium_heartbeat_settings');
101