Add Expand glance widget and add column support

[ad_1]

<?php

/*

Plugin Name: Dashboard Glance Items

Plugin URI: http://kcastellanos.mydevryportfolio.com

Description: Add More To At Glance

Version: 1.0

Author: Press Theme

Author URI: http://kcastellanos.mydevryportfolio.com/

*/

//Add 3 Dots To Large Number

// force one-column dashboard

function so_screen_layout_columnsf( $columns ) {

    $columns['dashboard'] = 2;

    return $columns;

}

add_filter( 'screen_layout_columns', 'so_screen_layout_columnsf' );

function so_screen_layout_dashboardf($columns) {

    return $columns;

}

add_filter( 'get_user_option_screen_layout_dashboard', 'so_screen_layout_dashboardf' );

function add3dots($string, $repl, $limit){

  if(strlen($string) > $limit){

    return substr($string, 0, $limit) . $repl; 

  }else{

    return $string;

  }

}

//Adds User Count To Dashboard Glance Items Disable For Now

//add_filter('dashboard_glance_items', 'user_count',12);

function user_count() {

$result = count_users();

if($result == 1){

echo '<li class="user-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/user.php"> ', $result['total_users'],' Total User</a></li>';

}else{

echo '<li class="user-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/user.php"> ', add3dots(number_format($result['total_users']), "...", 12),' Total Users</a></li>';

}

}

//Adds Madia Count To Dashboard Glance Items

add_filter('dashboard_glance_items', 'media_count',-5);

function media_count() {

$query_img_args = array(

'post_type' => 'attachment',

'post_status' => 'inherit',

'posts_per_page' => -1,

);

    $query_img = new WP_Query($query_img_args);

if($query_img->post_count == 0){

echo '<li class="media-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/upload.php?mode=list">No Medie Files Uploade Yet</a></li>';

}else if($query_img->post_count == 1){

        echo '<li class="media-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/upload.php?mode=list">',$query_img->post_count,' Medie File','</a></li>';

}else{

echo '<li class="media-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/upload.php?mode=list">',add3dots(number_format($query_img->post_count), "...", 12),' Medie Files','</a></li>';

}

}

//Get Inactive Plugin Count 

function get_inactive_plugin_count() {

    $plugins = count(get_plugins());

$active_plugin_count = count(wp_get_active_and_valid_plugins());   

return number_format($plugins - $active_plugin_count);

}

//Adds Active and Inactive Plugin Count To Dashboard Glance Items

add_filter('dashboard_glance_items', 'plugin_count');

function plugin_count() {

//Adds total Plugin Count To Dashboard Glance Items

echo '<li class="plugins-count total-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php">',count(get_plugins()),' Plugins','</a></li>';

//Adds Active Plugin Count To Dashboard Glance Items

if(count(get_plugins()) == 0 && is_plugin_active('dashboard_glance_items/mct-adv.php')){

echo '<li class="plugins-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugin-install.php">No Active Plugins Click Here to Add</a></li>';

}else if(!wp_get_active_and_valid_plugins() && is_plugin_active('dashboard_glance_items/mct-adv.php')){

echo '<li class="plugins-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=active">No Active Plugins WP Is Fast','</a></li>';

}else if(count(get_plugins()) == 1){

echo '<li class="plugins-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=active">',count(wp_get_active_and_valid_plugins()),' Active Plugin','</a></li>';

}else{

echo '<li class="plugins-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=active">',add3dots(number_format(count(wp_get_active_and_valid_plugins())), "...", 12),' Active Plugins','</a></li>';

}

echo '';

//Adds Inactive Plugin Count To Dashboard Glance Items

if(get_inactive_plugin_count() == -0){

echo '<li class="plugins-count inactive-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=active">No Inactive Plugins WP OverLoaded</a></li>';

}else if(count(get_plugins()) == -1){

echo '<li class="plugins-count inactive-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=inactive">',get_inactive_plugin_count(),' Inactive Plugin','</a></li>';

}else{

echo '<li class="plugins-count inactive-count"><a href="https://projectdmc.org/support/topic/add-expand-glance-widget-and-add-column-support/plugins.php?plugin_status=inactive">',add3dots(get_inactive_plugin_count(), "...", 12),' Inactive Plugins','</a></li>';

}

    echo '';

}

// Add Some CSS to "At a Glance" Widget

function custom_colors() {

echo'<style type="text/css">

#dashboard_right_now .user-count    a:before {content:"\f110"!important;}

        #dashboard_right_now .media-count   a:before {content:"\f104"!important;}

#dashboard_right_now .plugins-count a:before {content:"\f106"!important;}

    </style>';

if(is_plugin_active('Custom-Admin-Theme/Custom_admin_theme.php')){

echo '<style type="text/css">

  #dashboard_right_now .post-count, #dashboard_right_now .page-count, #dashboard_right_now .comment-count, #dashboard_right_now .comment-count,

  #dashboard_right_now .user-count, #dashboard_right_now .media-count, #dashboard_right_now .plugins-count, #dashboard_right_now .comment-mod-count {

border: 5px !important;

border-radius: 5px !important;

-webkit-border-radius: 5px !important;

-o-border-radius: 5px !important;

-moz-border-radius: 5px !important;

color: white !important;

line-height: 22px !important;

  }

  #dashboard_right_now .post-count, #dashboard_right_now .page-count, #dashboard_right_now .comment-count, #dashboard_right_now .comment-count,

  #dashboard_right_now .user-count, #dashboard_right_now .media-count, #dashboard_right_now .plugins-count,  #dashboard_right_now .comment-mod-count {

border: 2px !important;

color: white !important;

min-height: 29px !important;

min-width: 140px !important;

width: auto !important;

border-radius: 2px !important;

-webkit-border-radius: 2px !important;

-o-border-radius: 2px !important;

-moz-border-radius: 2px !important;

margin: 2px !important;

padding-right: 10px !important;

border: solid 1px rgba(0, 0, 0, 0.15) !important;

}

  #dashboard_right_now .user-count {

background:#0D70D7 !important;

}

#dashboard_right_now .media-count  {

background:rgb(182, 64, 0) !important;

}

#dashboard_right_now .plugins-count {

background:#067067 !important;

}

#dashboard_right_now .total-count {

background:#760760 !important;

padding-right: 0px !important;

}

#dashboard_right_now .inactive-count {

background:#555555 !important;

}

#dashboard_right_now .page-count {

   background: darkgreen !important; /* Old browsers */

}

#dashboard_right_now .post-count {

    background: GoldenRod !important; /* Old browsers */

}

#dashboard_right_now .comment-count {

    background: darkred !important; /* Old browsers */

}

#dashboard_right_now .comment-mod-count, #dashboard_right_now .update-plugins {

    background: #D54E21 !important; /* Old browsers */

}

#dashboard_right_now .user-count::before, #dashboard_right_now .media-count::before, #dashboard_right_now .plugins-count::before {

content: \'\' !important;

border: none 0px !important;

background: transparent !important;

box-shadow: none transparent !important;

}

      #dashboard_right_now .post-count a, #dashboard_right_now .page-count a, #dashboard_right_now .comment-count a, #dashboard_right_now .comment-count a,

      #dashboard_right_now .post-count a::before, #dashboard_right_now .page-count a::before, #dashboard_right_now .comment-count a::before, #dashboard_right_now .comment-count a::before,

#dashboard_right_now .user-count a::before, #dashboard_right_now .media-count a::before, #dashboard_right_now .plugins-count a::before,

#dashboard_right_now .user-count a, #dashboard_right_now .media-count a, #dashboard_right_now .plugins-count a,

#dashboard_right_now .user-count a:hover, #dashboard_right_now .media-count a:hover, #dashboard_right_now .plugins-count a:hover, 

#dashboard_right_now .comment-mod-count a, #dashboard_right_now .comment-mod-count a:hover, #dashboard_right_now .comment-mod-count a:before 

{

color: white !important;

line-height: 29px !important;

padding-left: 5px  !important;

}

</style>';

}

}

add_action('admin_head', 'custom_colors');

?>

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer