/**
Theme Name: magnus
Author: Brainstorm Force
Author URI: http://wpastra.com/about/
Description: Astra is the fastest, fully customizable & beautiful theme suitable for blogs, personal portfolios and business websites. It is very lightweight (less than 50KB on frontend) and offers unparalleled speed. Built with SEO in mind, Astra comes with schema.org code integrated so search engines will love your site. Astra offers plenty of sidebar options and widget areas giving you a full control for customizations. Furthermore, we have included special features and templates so feel free to choose any of your favorite page builder plugin to create pages flexibly. Some of the other features: # WooCommerce Ready # Responsive # Compatible with major plugins # Translation Ready # Extendible with premium addons # Regularly updated # Designed, Developed, Maintained & Supported by Brainstorm Force. Looking for a perfect base theme? Look no further. Astra is fast, fully customizable and beautiful theme!
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: magnus
Template: astra
*/

// Login Logo
function my_login_logo() { ?>
    <style type="text/css">
p.loginmessage-p {
    text-align: center;
    font-size: 14px;
}
#login h1 a, .login h1 a {
    background-image: url(https://www.raise-up.com.tw/wp-content/uploads/2020/01/logo-raiseup-back-01-01-1-e1579852557375.png);
    height: auto;
    width: 320px;
    background-size: auto 125px;
    background-repeat: no-repeat;
    padding-bottom: 100px;
}
.login label,a,input {
    font-family: Microsoft JhengHei !important;
    font-weight: 900;
}
input#wp-submit {
    width: 100% !important;
    margin-top: 20px;
}
.wp-core-ui .button-primary {
    background: #53514C !important;
    border-color: #53514C !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
    font-weight: 900 !important;
    font-size: 18px;
    height: 40px !important;
}
form#loginform {
    border-radius: 15px !important;
}
form#loginform:hover {
    box-shadow: 0px 60px 70px -35px #aaaaaa !important;
    transition-duration: .5s !important;
}
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

function my_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );

function my_login_logo_url_title() {
    return '本站由展躍有限公司製作';
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );

//控制台下方文字
function custom_dashboard_footer() {
    echo '展躍網頁設計公司';
}
add_filter('admin_footer_text', 'custom_dashboard_footer');

//歡迎訊息
function wpc_dashboard_widget_function() {
    echo '<p>您好，歡迎來到網站控制台。如果操作過程中有遇到任何問題，歡迎至 <a href="https://www.raise-up.com.tw">展躍網頁設計公司</a> 詢問，謝謝。</p>';
}
function wpc_add_dashboard_widgets() {
    wp_add_dashboard_widget('wp_dashboard_widgets', '網站訊息', 'wpc_dashboard_widget_function');
}
add_action('wp_dashboard_setup', 'wpc_add_dashboard_widgets');

//後台登入關閉功能訊息
function wpc_dashboard_widgets() {
    global $wp_meta_boxes;

    // 現況
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);

    // 近期迴響
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);

    // 收到新鏈結
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);

    // 外掛
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);

    // 快貼
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);

    // 近期草稿
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);

    // WordPress Blog
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);

    // Other WordPress News
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);

    // 活動
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);

    // 歡迎
    remove_action('welcome_panel', 'wp_welcome_panel');
}
add_action('wp_dashboard_setup', 'wpc_dashboard_widgets');

// 說明頁籤
function mytheme_remove_help_tabs($old_help, $screen_id, $screen) {
    $screen->remove_help_tabs();
    return $old_help;
}
add_filter('contextual_help', 'mytheme_remove_help_tabs', 999, 3);

/*停用自動新增分割圖片功能*/
function chnage_filter_image_sizes($sizes){
    $sizes = array();
    return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'chnage_filter_image_sizes');

/*隱藏全部非主管理者的後台更新資訊*/
add_action('admin_enqueue_scripts', 'ds_admin_theme_style');
add_action('login_enqueue_scripts', 'ds_admin_theme_style');
function ds_admin_theme_style() {
    if (!current_user_can( 'manage_options' )) {
        echo '<style>.update-nag, .updated, .error, .is-dismissible, .notice-error, .update-nag.bsf-update-nag, li#wp-admin-bar-wp-logo, li#wp-admin-bar-comments { display: none; }</style>';
    }
}